Re: Database Status in stored procedure
Posted in 1997
Joe <jfk@sigsys.com> Wrote:
<snip>
>I am wondering how I can get the database SQLSTATUS and ROW_COUNT when
>I execute an insert/update from a stored procedure. I noticed there is
>a status variable in 4GL, but it does me no good for this purpose.
>
>here's an example of what I want to do :
>
>insert into copy_table
> select * from original_table
> where col1 = var1;>let tempstatus = ROW_COUNT;
>if temp_status > 0 then
> let string = "we copied "||tempstatus||" row(s)"
>else
> let string = "no matches in original table - copy failed"
>end if;
>return string;
>ORACLE and Sybase have variables to let you get a count of how many
Joe,
In stored procedures use DBINFO('sqlca.sqlerrd2'), for number of rows
processed by, INSERT / UPDATE / DELETE EXECUTE PROCEDURE statements.
In 4GL check sqlca.sqlerrd[3], for number of rows processed by, INSERT /
UPDATE / DELETE statements.
Note :
DBINFO('sqlca.sqlerrd1') is equivalent to 4GL's sqlca.sqlerrd[2]
DBINFO('sqlca.sqlerrd2') is equivalent to 4GL's sqlca.sqlerrd[3]
And sqlca.sqlerrd[1] is not used/for future use.
Cheers
Felix K. Mathews
fmathews@systems.dhl.com