How do I create and return user defined data types in DB2.
F.ex
In Oracle I can create a user define datatype and return this data
type from stored function. How can I do the same in DB2?
SELECT id, SYSDATE
FROM t
WHERE id IN ( SELECT * FROM THE ( SELECT CAST( fn( :1 ) AS mydatatype
) FROM dual ) );
The above statements helps me to use bind variables for IN clause SQL
statement. As the number of IN LIST items are dynamic, I can not
hard-code number of bind variables. So I use a database function which
returns me signle element (splits by comma internally). So I have only
one bind variable which gets value from my stored function.
How to do the same in DB2? How can I write DB2 compatible query?
Thanks
Sameer