Is there a PostgreSQL equivalent of SELECT @@ROWCOUNT in T-SQL?

5.7k views Asked by At

Question says it all. Any help with working sample much appreciated.

Thanks.

1

There are 1 answers

0
Mitch Wheat On BEST ANSWER

This command allows retrieval of system status indicators. Each item is a key word identifying a state value to be assigned to the specified variable (which should be of the right data type to receive it). The currently available status items are ROW_COUNT, the number of rows processed by the last SQL command sent down to the SQL engine, and RESULT_OID, the OID of the last row inserted by the most recent SQL command. Note that RESULT_OID is only useful after an INSERT command into a table containing OIDs.

GET DIAGNOSTICS integer_var = ROW_COUNT;

Ref.