Re: Q: Assigning names to values returned from SP
Posted in 1997
> Edwin Babadaglian (edwinb@panix.com) wrote:
> : I am writing a Java applet that executes a stored procedure that
> : returns rows. I would like to use names rather that indexes to refer
> : to a column. If I execute the procedure from dbaccess, I get all
> : columns labeled '(expression)'. I've tried using the 'AS' keyword in
> : the return statement's column list but that's a syntax error.
If your procedure returns only one row (no resume) the following
works:
select procedurename() as anyname
from systables where tabid = 1
At least in dbaccess the heading becomes anyname instead of
(expression).
If there is a resume in the procedure to return multiple rows this
doesn't work, and I am quite sure there is no other solution
currently.
This is a bad situation for any type of programming. Beeing dependent
on the position of the returned values mean you have to manage your
stored procedures very carefully. If you ever need or want to change
something affecting the return statement you have to be extra aware of
the consequences. Of course even if names could be used you still have
significant maintenance issues.
Nils.Myklebust@idg.no
NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway
My opinions are those of my company
The Informix FAQ is at http://www.iiug.org