Escaping single quote in stored oracle procedure

我只是一个虾纸丫 提交于 2019-12-24 13:32:13

问题


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.

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?


回答1:


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.

Similar question: How to handle a single quote in Oracle SQL



来源:https://stackoverflow.com/questions/20679465/escaping-single-quote-in-stored-oracle-procedure

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!