Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to replace 2 single quotes to single quote

axvelazqNov 21 2012 — edited Nov 23 2012
Hi guys,

I have an script.sql that receives as a parameter an string.
example:

@C:/myscript.sql "o'connor"
user_account_value varchar2(120) := '&1';

EXECUTE IMMEDIATE "Select * from Table where column = :1 "  USING user_account_value 
I am not sure how to deal with string that contains single quotes.

If the parameter were passed as : "o''connor" this will work
If the parameter is pass as: "o'connor" this will not work.

so my question is what options do I have to deal with dynamic queries and single quotes.

I tried replacing replace(myParameter,'''',''''''); but not working well.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 21 2012
Added on Nov 21 2012
11 comments
6,277 views