Dynamic SQL problem in Store Procedure
I have the following code in a stored procedure:
set @s= concat('SELECT ID, replace(replace(field_a,''*'',''''),''\''',''\\'''')
FROM table where field_b = ',vVariable,'');
prepare stmt from @s;
execute stmt;
deallocate prepare stmt;
I'm getting syntax errors around the second replace. I want to find single quote characters in field_a and replace them were they occur with \'.
I think I've not got enough single quote marks but have tried many variations in the number of quote marks surrounding my find and replace patterns, but still get the syntax error.
Subject
Views
Written By
Posted
Dynamic SQL problem in Store Procedure
2242
July 13, 2012 06:55AM
1230
July 13, 2012 10:01AM
1450
July 13, 2012 04:26PM
1124
July 13, 2012 10:04PM
1228
July 18, 2012 05:03AM
1178
July 18, 2012 09:54AM
958
September 30, 2012 02:14PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.