I’m trying to open a REF CURSOR using a select statement like….
OPEN myREF FOR SELECT * FROM MYTABLE WHERE MYID IN (:Values) USING myPassedInValList;
But this only work when myPassedInValList has only a single ID in it. I’m trying to use a list like ‘1’,’2′,’5′, etc…
Can someone tell me why this doesn’t work.
I tried to Google but ‘Using’ is an awfully common word 🙁
You can’t use a user-defined type (presumably myPassedInValList is a varray or nested table?) in SQL like that. In order to reference the values from the UDT, you’ll need to use the
tablefunction, like so:The
tablefunction will translate the array into a table-like object in memory, which allows you to access it’s contents in SQL.This will only work if your UDT is defined as a database object (
CREATE TYPE...). If it’s defined in you package, the SQL won’t be able to see the definition.