| re: Is a statement like this possible: SELECT * FROM (CALL myProcedure)
"Markus" <TheRealHawk@Freenet.de> wrote in message
news:1129207983.038094.317480@g44g2000cwa.googlegr oups.com...[color=blue]
> I created a Stored Procedure like this:
> CREATE PROCEDURE myProcedure(IN a_tabschema VARCHAR(20))
> DYNAMIC RESULT SETS 1
> LANGUAGE SQL
> BEGIN
> DECLARE rs CURSOR WITH RETURN FOR
> SELECT * FROM syscat.tables WHERE tabschema = a_tabschema;
> OPEN rs;
> END
>
> If I make an CALL myProcedure('SYSIBM') I get an ResultSet
>
> But can I also user the Result in a new Statement like
> SELECT * FROM (CALL myProcedure('SYSIBM'));
> ?[/color]
No. To do this, what you really want to do is define a table function, and
use that in your SELECT.
For example (slightly abbreviated):
CREATE FUNCTION myFunction(a_tabschema VARCHAR(20))
LANGUAGE SQL
BEGIN
RETURN SELECT * FROM syscat.tables WHERE tabschema = a_tabschema;
END
Then in your application you can do this:
SELECT * FROM TABLE ( myFunction('SYSIBM') ) AS X;
[color=blue]
> On Question more: Is it possible to set the LIKE-operator
> case-insensitive?[/color]
No.
--
Matt Emmerton |