Re: SQL, SPL question
Posted in 1997
jcs@travelsurf.com wrote:
>
> Can I do the following :
>
> declare a SPL, say test_spl(), which return more than 1 value.
>
> in my select statment,
>
> SELECT test_spl() ...
>
> I try this, but the database complain about the spl returns too many
> values. how can I take care of this problem? Thanks.
I assume you mean you're trying to return more than one value in one
return statement in the SP. You can do this in SPL but you will not be
able to use that SP in select statements. To remedy this you have to
create two SP's and use them both in the select statement:
SELECT test_spl(),test_spl2() ...
The first SP actually performs the logic, returns the first value, but
stashes the other values in global variables. The second SP, and any
following, simply return the stashed values. This solution assumes that
the engine will actually execute the SP's in the order given in the
select statement.
----------------------------------------------------------------------
John H. Frantz Power-4gl: Extending Informix-4gl
frantz@centrum.is http://www.rl.is/~john/pow4gl.html