Re: Stored procedure problems
Posted in 1996
Harald Ums — — source: Informix-list mailing list archive (1991-1998)
Roger Hernandez <rogerh@shadow.net> wrote:
>I am trying to create stored procedure which will insert a row into a
>table which has a serial column, and will return me the generated values
>by using DBINFO. Any ideas why its not working (its returing a huge
>negative number)?:
>CREATE PROCEDURE sp_prov_srvc (p_sub_id INT, p_srvc_typ INT, p_ct_typ
>INT)
> RETURNING INT;
> DEFINE r_last_serial INT;
> INSERT INTO wasabi.v_srvc (sub_id, srvc_typ)
> VALUES (p_sub_id, p_srvc_typ);
> SELECT DBINFO ('sqlca.sqlerrd1'), COUNT (*)
> INTO r_last_serial
> FROM wasabi.v_srvc;
RTFM Informix Guide to SQL 1-569
use
LET r_last_serial = DBINFO ('sqlca.sqlerrd1');
instead of your last statement.
Ciao
Harald Ums