Re: How to read SQLERRD with Stored Procedure Language
Posted in 1997
Jeff So — — source: Informix-list mailing list archive (1991-1998)
On Fri, 1 Aug 1997, Bradford Young wrote:
> I want a simple stored procedure that will delete rows from
> a table given an argument and return the number of rows that
> were deleted. SQLERRD[2] holds this value, but I don't know
> how to read it and return it from within the SP. I would like
> to avoid hauling out the cudgel and counting with a select
> statement prior to the delete statement, since the delete
> includes a select anyway. Please advise on how to read the
> SQL communications area. Thanks.
>
CREATE PROCEDURE delete_something(...)
RETURNING INT; DEFINE row_delete INT;
DELETE .....
LET row_delete = DBINFO('sqlca.sqlerrd2');
RETURN row_delete;
END PROCEDURE;