On 19 Feb 2010, at 6:42, Yan Cheng Cheok wrote:
> -- HOW?!?!
> --ERROR: column "rowcount" does not exist
> --LINE 1: SELECT @@ROWCOUNT=0
> IF @@ROWCOUNT=0 THEN
> EXECUTE 'INSERT INTO statistic(fk_lot_id, "value", measurement_type, statistic_type) VALUES ($1, $2, $3, $4)'
> USING _lotID, _value, _measurementType, _statisticType;
> END IF;
> May I know what is the correct PostgreSQL syntax for @@ROWCOUNT after update?
In plpgsql you can test for FOUND or NOT FOUND after performing a query:
IF NOT FOUND THEN
EXECUTE '...'
END IF;
I think that's more convenient for your case than counting actual rows.
Alban Hertroys
--
Screwing up is the best way to attach something to the ceiling.
!DSPAM:737,4b7e795110442010528220!