Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Convert comma delimited numbers to numbers in SQL IN query
Hi
I have a qurey like this in a stored procedure.
SELECT field1, field2 from myTable1 WHERE tablePk IN (100, 200, 300,
400);
In above query the number of values in IN clause are not known when the procedure is invoked from JDBC. Hence the stored procedure takes a VARCHAR2 parameter with all the values in a comma delimited form. E.g.: "100, 200, 300, 400").
Howevever I cannot do something like this: SELECT field1, field2 from myTable1 WHERE tablePk IN (myStoreProcParam);
because the param myStoreProcParam is of type VARCHAR2, whereas the tablePk is of type NUMBER.
How do I solve this problem? Received on Thu May 25 2006 - 10:27:45 CDT