PL/pgSQL - Mailing list pgsql-interfaces

From Michael Fork
Subject PL/pgSQL
Date
Msg-id Pine.BSI.4.21.0004051953250.13461-100000@glass.toledolink.com
Whole thread Raw
List pgsql-interfaces
After creating the following trigger and function, no more records
are added to the datbase, with no visible errors, exceptions, etc.  Does
anyone see my mistake?  Thanks in advance.

CREATE FUNCTION ti_acct_update() RETURNS OPAQUE AS           'DECLARE         time int4;       BEGIN         IF
NEW.acctstatustype= ''STOP'' THEN           SELECT ti_time INTO prev_time FROM tiacct WHERE             ((NEW.username
=ti_username) AND              (datepart(''month'', NEW.tstamp) == ti_month) AND
(datepart(''year'',NEW.tstamp)== ti_year));           IF NOT FOUND THEN             INSERT INTO tiacct (ti_username,
ti_month,ti_year, ti_time)                 VALUES (NEW.username, datepart(''month'', NEW.tstamp),
datepart(''year'',NEW.tstamp),NEW.acctsessiontime);            ELSE              time := prev_time +
NEW.acctsessiontime;             UPDATE tiacct (ti_time) VALUES (time) WHERE          ((NEW.username = ti_username) AND
               (datepart(''month'', NEW.tstamp) == ti_month) AND                (datepart(''year'',NEW.tstamp) ==
ti_year));          END IF;         END IF;         RETURN NEW;       END;       '       LANGUAGE 'plpgsql';

CREATE TRIGGER ti_acct_update AFTER INSERT ON radacct
FOR EACH ROW EXECUTE PROCEDURE ti_acct_update();

Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio



pgsql-interfaces by date:

Previous
From: Kovacs Zoltan Sandor
Date:
Subject: Re: refint doesn't work well with BDE
Next
From: Nikolai Turchanikov
Date:
Subject: JDBC: Method setBinaryStream Question