![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 Thanks in advance |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
none of these examples worked. I get an error that says: PLS-00642: local collection types not allowed in SQL statements As a reminder, I am on version 8i. I noticed the page with the examples says Version 10.1-not sure if that is the example version or the Oracle version any other help? thanks in advance |
#5
| |||
| |||
|
#6
| |||
| |||
|
#7
| |||
| |||
|
|
ndpace (AT) gmail (DOT) 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 |
#8
| |||
| |||
|
#9
| |||
| |||
|
|
DA Morgan (damorgan (AT) psoug (DOT) org) wrote: : Malcolm Dew-Jones wrote: : > ndpace (AT) gmail (DOT) 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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |