Re: PL/SQL variable number of ORs in SELECT

From: Darby Crash <nospam_at_satan.com>
Date: 1997/08/10
Message-ID: <01bca600$92be7f20$12e52299_at_jharby>#1/1


Yes, and you might want to rewrite the statement as ... WHERE my_num IN ('22','34','67', ...)
and use a varray for the bind - if you're still on 7.x, look at PL/SQL tables.

Frank Curti <curti_at_rci.rutgers.edu> wrote in article <5s7nmm$bkf_at_amenti.rutgers.edu>...
> I have a stored procedure that must build cursors based on an input
> string that contains a variable number of search parameters that are
> ORed together in a select statement.
> For instance if I pass in the string 22;34;67 I would have the
> following statement
> OPEN cursor_name FOR SELECT * FROM my_table WHERE my_num = '22'
> OR my_num = '34' OR my_num = '67';
>
> Can I build this dynamically, in some instances we may have to pass in up
> to 100 search parameters. I looked at the DBMS_SQL package but was
 unable
> to find a way to use it in this case.
>
> Thank you
> Frank Curti
>
Received on Sun Aug 10 1997 - 00:00:00 CEST

Original text of this message