oracle 如何从包含单引号的oracle数据库中搜索数据
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3940984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to search data from oracle database which contains single quote
提问by MAS1
my_table
contains three columns: name
, address1
, and address2
.
my_table
包含三列:name
,address1
,和address2
。
I want to find all records which contains single quotes. How can I do this?
我想找到所有包含单引号的记录。我怎样才能做到这一点?
回答by Frédéric Hamidi
You have to escape the single quotes in the expressions by doubling them, e.g.:
您必须通过将表达式中的单引号加倍来转义它们,例如:
select * from my_table
where name like '%''%'
or address1 like '%''%'
or address2 like '%''%';
回答by dg157
... where name || address1 || address2 like '%''%';
... 其中名称 || 地址1 || address2 like '%''%';