Re: stored procedure how to retrive more one row ?
Posted in 1996
Which language are you using, or in which context do you want to use it?
Or, where are you getting the error? These are rhetorical questions; the
answers are below.
In DB-Access or ISQL, use:
EXECUTE PROCEDURE ProcedureName(arg1, arg2, ...);
In ESQL/C, use:
EXEC SQL DECLARE c_proc CURSOR FOR EXECUTE PROCEDURE ProcedureName(arg1, arg2, ...);
EXEC SQL OPEN c_proc;
while (sqlca.sqlcode == 0)
{
EXEC SQL FETCH c_proc INTO val1, val2, ...;
if (sqlca.sqlcode != 0)
break;
...
}
EXEC SQL CLOSE c_proc;
EXEC SQL FREE c_proc;
In I4GL, use:
PREPARE p_proc FROM "EXECUTE PROCEDURE ProcedureName(?, ?, ...)"
DECLARE c_proc CURSOR FOR p_proc
FOREACH c_proc USING arg1, arg2, ... INTO val1, val2, ...
...
END FOREACH
FREE c_proc
FREE p_proc -- 6.0x I4GL only!
What do you mean -- I4GL doesn't support USING? Get a more recent version
than you're using and read the release notes.
And inside the SP, you use RETURN val1, val2, ... WITH RESUME, probably in
the context of a FOREACH loop.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
>From: leone@galactica.it (Angelo PAGOTTO)
>Date: Mon, 05 Feb 1996 19:14:54 GMT
>X-Informix-List-Id: <news.20926>
>
>Hi my name is Angelo
>
>With a little help of other user I have founded how to create a stored
>procedure ( by dbaccess ) but now I have a problem:
>If I make a select that return more rows I recieve a error message.
>Is there anyone that sends me an example of stored procedure that
>return more than one records?
>
>for example I want to create a procedure that retrive orders
>between two date.
>
>Thanks for your answer.