I’ve always struggled with how many single quotes to put in some SQL statements.
e.g If you want to select from dual the string
“I’ve got a luverly bunch o’ coconuts”
The SQL if something like
Select ‘I’’ve got a luverly bunch o’’ coconuts’ from dual;
An alternative and a far easier method to remember I think (only works with 10g) is
Select q’(I’ve got a luverly bunch o’ coconuts)’ from dual;
i.e. surround the string with q’( string )’
N.B The bracket can be any bracket (I believe) i.e. q['string]' or q'{string}'
No comments:
Post a Comment