Subject | Re: [firebird-support] Rows affected... |
---|---|
Author | Alexandre Benson Smith |
Post date | 2004-07-09T00:41:20Z |
Rasmus Olesen wrote:
Take a look on page 22 of Firebird 1.5 Release notes, here an excerpt:
ROW_COUNT
Returns an integer, the number of rows affected by the last DML
statement. Available in PSQL, in the
context of the procedure or trigger module. Currently returns zero from
a SELECT statement.
Syntax
ROW_COUNT
Example
UPDATE TABLE1 SET FIELD1 = 0 WHERE ID = :ID;
IF (ROW_COUNT = 0) THEN
INSERT INTO TABLE1 (ID, FIELD1) VALUES (:ID, 0);
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
>HiRasmus,
>
>In MSSQL one can use the @@RowCount system value, that holds :
>
>--MSSQL help--
>Returns the number of rows affected by the last statement
>--MSSQL help--
>
>What is the closest equiv. in FB 1.5 ?
>
>More specifically : I want to optimize the translation of this in
>general :
>(MSSQL)
><select query>
>if @@ROWCOUNT = 0 then <do_something_rescue>
>
>..without doing the trivial ineff. rewrite :
>(FB)
>(select count(*) <same select's FROM+WHERE part, FB flavoured>)
>into :tmp;
>if(:tmp = 0) then <do_something_rescue>
>else
><select query, FB flavoured>;
>
>tia.
>/Rasmus
>
>
Take a look on page 22 of Firebird 1.5 Release notes, here an excerpt:
ROW_COUNT
Returns an integer, the number of rows affected by the last DML
statement. Available in PSQL, in the
context of the procedure or trigger module. Currently returns zero from
a SELECT statement.
Syntax
ROW_COUNT
Example
UPDATE TABLE1 SET FIELD1 = 0 WHERE ID = :ID;
IF (ROW_COUNT = 0) THEN
INSERT INTO TABLE1 (ID, FIELD1) VALUES (:ID, 0);
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br