Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

Single quoting singe quotes (Confusion?)

I am looking through a really large Oracle stored procedure that was written by an ex team member who left
several years ago. I noticed that in the stored procedure that many, many strings are surounded by four
single quotes. str := strName + '''' + strId; There are also other places that four single quotes are used.
(Question 1)Would it ever be necessary to add more than four single quotes?? Note that my stored procedure is not created
within an exec statement, so I don't see how  more than four single quotes would be necessary? I imagine that more
than four would be a syntax error?

Question 2 : Would it ever be necessary to single quote double quotes ? I am talking about the double quotes that come from the double
quote on the keyboard?

I see at the link below that you can escape single quotes, if the sql is within an exec statement. So in that case my string
above would be the following : str := strName + '''''' + strId;
where there are a total of six single quotes.

http://www.dba-oracle.com/t_oracle_execute_immediate.htm

Just trying to clear this up, as I am feeling overwhelmed by all of the single quotes and how many should be used, and when?
With all of the single quotes I see, it is difficult to determine if some of them are also double quotes?
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial