我想从Oracle DB中检索数据,其中name包含单引号(')
Select * from table_name where name in ('Joel D'Silva','O'neil Dsa');
答案 0 :(得分:4)
您可以在以下字符串中将字符串传递给q'[]'
:
Select * from table_name where name in (q'[Joel D'Silva','O'neil Dsa]');
或者你可以在下面两次使用引用'
:
Select * from table_name where name in ('Joel D''Silva'',''O''neil Dsa');
答案 1 :(得分:2)
将'
替换为''
:
Select * from table_name where name in ('Joel D''Silva','O''neil Dsa');