Hi,
Just stepping into the world of SQL/PL I try to create a table
function. It must be something stupid but I can't find what I'm doing
wrong.
The create statement is:
CREATE PROCEDURE grantall_t (in_schema CHAR(128),
in_osgroup CHAR(30))
RETURNS TABLE (tbl_message CHAR(128))
LANGUAGE SQL
MODIFIES SQL DATA
BEGIN
..... snipped code
RETURN SELECT t_tabname from session.tabname_temp;
END @
The error message:
DB21034E The command was processed as an SQL statement because it
was not a valid Command Line Processor command. During SQL
processing it returned:
SQL0104N An unexpected token "RETURNS" was found following
in_osgroup CHAR(30)) ". Expected tokens may include: "FROM". LINE
NUMBER=2.
SQLSTATE=42601
Brian Tkatch - 23 Nov 2005 19:27 GMT
A PROCEDURE does not use RETURNS, that is a FUNCTION.
To get a TABLE from a PROCEDURE, a CURSOR WITH RETURN TO ... should be
OPENed but not CLOSEd.
B.
Gert van der Kooij - 23 Nov 2005 19:34 GMT
> A PROCEDURE does not use RETURNS, that is a FUNCTION.
>
> To get a TABLE from a PROCEDURE, a CURSOR WITH RETURN TO ... should be
> OPENed but not CLOSEd.
>
> B.
As I said, I was doing something stupid :)
Thanks