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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL help

Re: SQL help

From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 24 May 2005 22:15:17 -0700
Message-ID: <1116997850.771501@yasure>


Malcolm Dew-Jones wrote:
> ndpace_at_gmail.com wrote:
> : I am creating a package for Oracle 8i. I need to pass a variable in
> : and use that in the SQL statement IN clause. This worked for a simple
> : equal statement but not for the IN.
>
> : 'select * from CUSTOMERS where CUSTOMERS_CODE in (:x1) ' USING IDS;
>
> : where IDS is VARCHAR2 and = 999,1000
>
> I'm sure google would turn up suggestions, since this is often discussed.
>
> One technique is to pass the list (999,1000) as a string '999,1000', and
> then use a string function such as the PL/SQL Oracle equivalent of C's
> strstr() (I don't recall the name of the function, that is why I don't
> give the name).
>
> If strstr where available, you could do something like
>
>
> where strstr(:X,to_char(CUSTOMERS_CODE)) is not null

Why SUBSTR when you can feed it in directly?

http://www.psoug.org
click on Morgan's Library
click on Conditions
search for the "Complex IN Demo

-- 
Daniel A. Morgan
Relational theory is not something that is simply a nice-to-have.
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Wed May 25 2005 - 00:15:17 CDT

Original text of this message

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