Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> PL/SQL Dynamic where clause Q

PL/SQL Dynamic where clause Q

From: Nathan D. Hughes <nhughes_at_well.com>
Date: 1998/01/22
Message-ID: <6a7qag$k43$1@was.hooked.net>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US