Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL help
Malcolm Dew-Jones wrote:
> DA Morgan (damorgan_at_psoug.org) wrote:
> : 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?
>
> I didn't use SUBSTR, so I'm not sure what you mean.
>
> --
>
> This space not for rent.
Sorry ... responded to the wrong post.
-- 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 - 09:07:05 CDT
![]() |
![]() |