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!

Wildcard in SELECT statement defined as a variable

618236Sep 14 2009 — edited Sep 14 2009
Hi,

The following query works in a PL/SQL procedure (it's defined in a variable because the WHERE clause will eventually be built at run time):

l_select_statement VARCHAR2(4000) :=
'SELECT XMLELEMENT (
..........
FROM WEB_VPREPARATIONS W WHERE CODE LIKE :code';

I execute it via a cursor, like this:

OPEN l_prod_cv FOR l_select_statement USING in_code;

I would like to add the '%' wildcard on either side of ':code', but nothing that I've tried works (e.g., LIKE ''%:code%'' using two single quotes on either side). Any help would be greatly appreciated. Thanks,

Chris.
This post has been answered by 189821 on Sep 14 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 12 2009
Added on Sep 14 2009
6 comments
934 views