Re: more than one return value from SPL?
Posted in 1996
Chris Drauch wrote:
>
> MFerris wrote
> >
> >cdr@xteam.co.at (Chris Drauch) writes:
> >>
> >> It's easy to use the SPL as
> >> select name, call_number (state,phone) from ....> >> if the SP 'call_number' is returning just **one** value.
> >> But how to do if there is more than one? Using DB-Access I've got:
> >>
> >You need to put your SQL statement in a FOREACH loop:
> >
> >FOREACH
> > Select col1, col2,col3 ....
> > Return var1,var2,var3 WITH RESUME;> >END FOREACH
> >
> >The "WITH RESUME" statement is very important as it tells
> >Informix to go back for more data after the first select.
>
> I don't have multiple rows, just multiple return values. I will try to clarify:
>
> # create procedure test() returning int,int;
> # return 1,2;
> # end procedure
>
> and a following:
>
> # execute procedure test();
>
> (expression) (expression)
>
> 1 2
>
> # select name, zip, test() from customer;
>
> --> 684: Procedure (informix.test) returns too many values
>
> --
> Chris Drauch <cdr@xteam.co.at> ... just speaking for myself ...
When referencing a stored procedure as an expression of a select
statement, you must follow the rules of any expression. Put
another way, an expression can have one and only one value. In
a select statement, the call to the SPL is an expression. When
used with [execute procedure], [call], or [let v1, v2,
v3=spl(a,b,c,d)] you remove that limitation.
I hope this makes sense. If not, refer to the Informix Guide to
SQL - Tutorial, chapter 12.
cludwigsen@harrahs.com
Chuck Ludwigsen Harrah's Entertainment
+-----------------------------------------------------+
: Proud daddie of a 7 lb 14 oz baby girl born 8/15/96 :
+-----------------------------------------------------+