Subject RE: [firebird-support] Return code inside SP
Author Franky Brandt
Sure Nick, it's easy too.

The way I would do it is by assigning one output parameter in the SP (a
integer for instance) and fill that up with a unique value from whatever you
are doing in the procedure.

For instance, if the procedure does a INSERT INTO you might want to change
it in a FOR SELECT ... FROM .. DO and in that select do the insert and fill
up the output variable.

When calling the procedure simply do 'select count(MyOutPutField) from
MyProcedure' to get the result count.

An alternative would be to have the output variable have one record always
with the record count in, it should be faster than the first i think.

For instance:

Output parameter MyRecordCounter Integer; on start of the procedure Set it
to 0, increase by one for each record inserted, on execute do Select
MyRecordCounter from MyProcedure.

Just an idea, hope this helps you out.


[] On Behalf Of Nick
Sent: dinsdag 4 juli 2006 23:17
Subject: [firebird-support] Return code inside SP

If I have an insert statement within an SP is there a way to see the number
of rows that were inserted without having a separate query within the SP to
count them.

-----We Solve your Computer Problems---
UNIX, C, Panther, Ingres, Interbase, Firebird - Available Shortly

[Non-text portions of this message have been removed]