From: | ioan ghip <ioan(at)pangea-comm(dot)com> |
---|---|
To: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Trying to move away from Firebird |
Date: | 2016-02-12 22:11:50 |
Message-ID: | CANtHMv-FZaU1nZUxzgrm9UJJhY3OoEXN181igsKd3RObJujHUA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I was able to create all the domains, tables, views, etc, but I have
trouble creating stored procedures and triggers. Also, a question, does
Postgres support events, for example in Firebird I could do something like
this and then receive the event in the GUI:
if ((NEW.MUSED_M_>=NEW.MLIMIT_M_) and (NEW.MLIMIT_M_>0) and
(NEW.ISACTIVE=1) and (NEW.FAXTOFAXFLAG=1)) then
begin
POST_EVENT 'deactivate_f2f';
end
Please help me translate the examples bellow so I can understand the
differences:
CREATE GENERATOR GENADMINID START WITH 0 INCREMENT BY 1;
SET GENERATOR GENADMINID TO 108;
CREATE TRIGGER B_UPDATE_COMPANY FOR COMPANY
ACTIVE AFTER UPDATE POSITION 10
AS
begin
if (old.AGENTID != new.AGENTID) then
begin
update USERS set USERS.AGENTID=new.AGENTID where USERS.COMPANYID =
new.COMPANYID;
end
end
CREATE PROCEDURE GET_ATA_STATUS (
MAC VARCHAR(128),
NOW_D_ INTEGER)
RETURNS (
ATA_STATUS INTEGER)
AS
begin
SELECT IIF((a.TIMESTAMP_D_ + a.EXPIRE) > :NOW_D_, 1, 0) FROM ATA a WHERE
a.ATAMAC = :MAC into :ATA_STATUS;
SUSPEND;
end
Thanks a lot.
From | Date | Subject | |
---|---|---|---|
Next Message | Sebastian P. Luque | 2016-02-12 22:19:07 | Re: 9.4 -> 9.5 dump size reduction |
Previous Message | ioan ghip | 2016-02-12 21:06:02 | Help me get started with moving away from Firebird |