Subject Re: [firebird-support] Execute Statement & Row_Count in SP
Author Martijn Tonies
Hi,

> >In a SP I have the following lines:
> >.
> >EXECUTE STATEMENT
> >'UPDATE ATAB SET ' || UPDATECLAUSE || ' WHERE ' || WHERECLAUSE;
> >ROWSAFFECTED = ROW_COUNT;
> >.
> >.
> >
> >The DML statement works fine but ROW_COUNT returns 0 even when a row has
> >been updated.
> >Doesn't EXECUTE STATEMENT set ROW_COUNT?
>
> No.
> The procedure doesn't know what's happening in the EXECUTE STATEMENT
> call. It doesn't have any way of knowing what is in that string at
compile
> time, so that it might set up the row_count. Even at run time, it only
> knows to send a string out to the DSQL processor: it doesn't validate
> what's in the string, other than that it is a well-formed string.
>
> Read the release notes regarding EXECUTE STATEMENT. Really, it's just a
> useful hack. It's not the magic bullet you want it to be.

I must say this surprises me a bit -- it does catch error codes,
right? If so, why not RowsAffected/RowCount/whatever you
would like to call it.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com