在存储的oracle过程中转义单引号 [英] Escaping single quote in stored oracle procedure
问题描述
我有一个存储过程,该存储过程从表中读取值,然后使用更新查询在其中添加前缀并更新表.
I have a stored procedure which reads value from the table and then using update query it appends a prefix in it and update the table.
但是我在表中获取值的问题包含单引号('),因此在更新查询中使用它时无法正常工作.
But the issue that I am getting the value in table contains single quote(') so when I use it in update query is not working.
如何用两个单引号将该单引号转义? 简要地说,我想检查...: 1.如果从表中获取的值中存在单引号. 2.如果是,则将单引号替换为双引号,否则不执行任何操作 怎么能做到?
How can I escape this single quote by two single quotes? Briefly I want to check...: 1. if single quote exists in the value fetched from table. 2. if yes, then replace single quote with double quote else do nothing How can this be achievd?
推荐答案
要转义单个,请使用另一个".例如,包含单个'的字符串如下所示:
To escape a single ' you use another '. For example a string containing a single ' looks like this:
''''
两个'作为字符串的开头和结尾,另一个'用来逃避您实际想要的'.
Two ' as start and finish of the string and a ' to escape the ' you actually want.
类似的问题: 如何在Oracle SQL中处理单引号
这篇关于在存储的oracle过程中转义单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!