问题
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