ORACLE特殊字符的處理方法

一、insertsql

好比插入如下語句:測試

insert into s830_online (usercode,trailercode,contentname) values ('t2','00000020010000002008','vod~!@#$%^&*()_+{}:?`-=[]\',./ kong tab~!@#¥%……&×()——+{}:」《》?‘’');spa


哇噻,全是特殊字符的處理。code


其中,最噁心的是單引號;通過測試,打開轉義開關set escape on,並對sql進行轉義後仍然保存不了。ci

會報如下錯誤字符串

ORA-01756: 引號內的字符串沒有正確結束select

修改如下查詢

把單引號換成對應的ascii值後就能夠了,轉換後的sqltab

insert into s830_online (usercode,trailercode,contentname) values ('t2','00000020010000002008','vod~!@#$%^&*()_+{}:?`-=[]\'||chr(39)||',./ kong tab~!@#¥%……&×()——+{}:」《》?‘’');co


二、查詢select 

同理。

相關文章
相關標籤/搜索