Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> PL/SQL Dynamic where clause Q
I've got a procedure that builds a query based on the parameters passed in. In the WHERE clause, I'd like to match a status code with multiple values using an IN, i.e.
where status in ('OPEN','WAITING')
Assigning a variable the complete list (p_status := '''OPEN'',''WAITING''';, WHERE status IN (p_status);) does not work in the where clause - no rows returned. Using seperate variables for each status code will work in the where (WHERE status IN (p_status1, p_status2); ), but due to the dynamic nature of the query, this solution is not optimal. I've played around with the p_status variable format (single quotes different places, etc.) but haven't gotten a result that works.
Any workarounds? Thanks!
-- Nathan D. Hughes <nhughes_at_well.com> Senior Consultant, Custom Business Solutions, Inc.Received on Thu Jan 22 1998 - 00:00:00 CST