隨筆 - 100  文章 - 50  trackbacks - 0
          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          常用鏈接

          留言簿(3)

          隨筆分類(lèi)

          隨筆檔案

          文章分類(lèi)

          文章檔案

          收藏夾

          我收藏的一些文章!

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          java.sql.SQLException: ORA-00911: invalid character
          2008年04月15日 星期二 10:37

          控制臺(tái)拋出這個(gè)異常:java.sql.SQLException: ORA-00911: invalid character
          查了一下說(shuō)是oracle字符集設(shè)置的問(wèn)題。我將拋異常的SQL語(yǔ)句在控制臺(tái)輸出如下:

          select count(t.id) as onerowc,t.id as areatravelid ,b.id as airpotid from base_areatravel t inner join base_airpot b on b.areaid=t.id group by t.id ,b.id;

          以上是完完整整的輸出結(jié)果,然后我將語(yǔ)句復(fù)制到PL/SQL中執(zhí)行是完全可以的,沒(méi)有任何異常的。。

          而我在程序中定義的sql如下:

          String sql="select count(t.id) as onerowc,t.id as areatravelid ,b.id as airpotid from base_areatravel t"+
              " inner join base_airpot b on b.areaid=t.id group by t.id ,b.id;";

          呵呵,花費(fèi)了半個(gè)多小時(shí)終于找到原因::::

          哈哈,,定義語(yǔ)句中sql后面多了一個(gè)分號(hào)。(“;”)暈菜。。這樣的話在PL/SQL中是無(wú)所謂的,可是Java 的數(shù)據(jù)庫(kù)驅(qū)動(dòng)卻不識(shí)別這樣的語(yǔ)句了。汗,,,太大意了。記錄下來(lái)防止再次犯錯(cuò),呵呵。。。

          posted on 2010-04-06 21:42 fly 閱讀(41805) 評(píng)論(23)  編輯  收藏 所屬分類(lèi): 數(shù)據(jù)庫(kù)學(xué)習(xí)

          FeedBack:
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn))[未登錄](méi) 2011-12-19 18:32 amy
          和你一樣的錯(cuò),非常感謝  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2012-03-21 19:33 xiaoxihai
          恩人啊。。。。。。  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2012-03-26 00:04 哈哈鏡
          多幾個(gè)你這樣的好心人就好了  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2012-03-31 15:42 暈菜
          呵呵,我也犯了這樣的錯(cuò)誤  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2012-05-10 18:02 別問(wèn)我是誰(shuí)
          注意這種錯(cuò)誤啊,犯過(guò)一次,今天還犯了。注意啊注意。  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2012-07-19 21:30 zeroren
          沒(méi)錯(cuò),按你說(shuō)的我檢查下果然是這問(wèn)題,謝謝。  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2012-08-14 17:51 3Q
          果然我也犯了同樣的錯(cuò)誤 謝謝你啦  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2012-08-20 13:59 wangfanq
          有些不是這個(gè)錯(cuò)誤  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2012-08-20 14:00 化生
          @amy我這個(gè)是別人那兒能運(yùn)行,我這兒就不行了,反復(fù)檢查不是樓主說(shuō)的這個(gè)問(wèn)題?
            回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2012-09-17 10:16 地方
          實(shí)在是感謝啊~~一個(gè)分號(hào)搞了我半天····  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn))[未登錄](méi) 2013-03-06 19:38 且聽(tīng)風(fēng)吟
          樓主,太好人了,這個(gè)錯(cuò)誤很隱秘啊。  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2013-03-22 11:22 shanshan
          看看有不懂馬上百度,就看到樓主的解決方案了,謝謝!  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2013-04-10 19:44 11
          謝謝樓主  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2013-05-13 15:53 psz
          謝謝啦,問(wèn)題一樣  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2013-06-14 14:12 yoyo_zeng
          樓主是好人啊,我太粗心了!  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2013-06-14 16:25 jcyzone
          我也出這樣的問(wèn)題了,但是沒(méi)有多分好求指導(dǎo)啊  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn))[未登錄](méi) 2013-07-25 09:50 小虎
          同錯(cuò)  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2013-09-10 17:07 ocean
          非常感謝  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2013-09-13 13:24 感謝LZ
          我只想說(shuō) ,非常感謝,!!這個(gè)問(wèn)題差點(diǎn)搞死我。。。。真的發(fā)現(xiàn)不了啊。。  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2013-09-13 14:10 咔咔
          還真是分號(hào)的問(wèn)題,我艸了。  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn)) 2013-12-20 11:14 Eline
          還真是分號(hào)的問(wèn)題,我艸..  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn))[未登錄](méi) 2013-12-27 10:48 xx
          終于找到問(wèn)題了,好人一生平安!  回復(fù)  更多評(píng)論
            
          # re: java.sql.SQLException: ORA-00911: invalid character 解決方法(轉(zhuǎn))[未登錄](méi) 2016-06-01 11:01 zxc
          廢了半天勁,終于找到了,原來(lái)是最后邊多了個(gè)分號(hào)  回復(fù)  更多評(píng)論
            
          主站蜘蛛池模板: 涟源市| 遵化市| 施秉县| 福州市| 宁陕县| 慈溪市| 临高县| 蛟河市| 永济市| 鹿邑县| 磐安县| 松江区| 景洪市| 洪江市| 高青县| 鞍山市| 淮阳县| 离岛区| 荆州市| 晋城| 合水县| 龙川县| 陵水| 周口市| 华容县| 太仆寺旗| 五莲县| 永宁县| 富裕县| 宜宾市| 宁南县| 华池县| 万宁市| 蒲江县| 弥勒县| 内江市| 永修县| 溧水县| 门头沟区| 昆明市| 恩平市|