If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > how to migrate oracle trigger into informix

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-29-03, 22:50
cnfan cnfan is offline
Registered User
 
Join Date: Sep 2003
Posts: 1
how to migrate oracle trigger into informix

create table one
(
col1 varchar(10),
col2 varchar(10)
);


In Oracle:
CREATE TRIGGER test
AFTER UPDATE OF col1 ON one
FOR EACH ROW
BEGIN
if :new.col1 = 0 and ld.col1 <> 0 then
.....
end if;
if :new.col1 <> 0 and ld.col1 =0 then
.....
end if;
END;

In Informix
Method_1
CREATE TRIGGER test_1
UPDATE OF col1 ON one
REFERENCING OLD AS deleted NEW AS inserted
FOR EACH ROW
WHEN (NEW.col1 = 0
AND OLD.col1 != 0)
(.....)

CREATE TRIGGER test_2
UPDATE OF col1 ON one
REFERENCING OLD AS deleted NEW AS inserted
FOR EACH ROW
WHEN (NEW.col1 != 0
AND OLD.col1 = 0)
(.....)

Method_2
CREATE TRIGGER test
UPDATE OF col1 ON one
REFERENCING OLD AS deleted NEW AS inserted
FOR EACH ROW
(EXECUTE procedure);
In procedure, to do with the "IF..."

what difference between the Method_1 and Method_2, or you have a better way ?

Thanks a lot
Reply With Quote
  #2 (permalink)  
Old 10-30-03, 08:25
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Re: how to migrate oracle trigger into informix

Quote:
Originally posted by cnfan
create table one
(
col1 varchar(10),
col2 varchar(10)
);


In Oracle:
CREATE TRIGGER test
AFTER UPDATE OF col1 ON one
FOR EACH ROW
BEGIN
if :new.col1 = 0 and ld.col1 <> 0 then
.....
end if;
if :new.col1 <> 0 and ld.col1 =0 then
.....
end if;
END;

In Informix
Method_1
CREATE TRIGGER test_1
UPDATE OF col1 ON one
REFERENCING OLD AS deleted NEW AS inserted
FOR EACH ROW
WHEN (NEW.col1 = 0
AND OLD.col1 != 0)
(.....)

CREATE TRIGGER test_2
UPDATE OF col1 ON one
REFERENCING OLD AS deleted NEW AS inserted
FOR EACH ROW
WHEN (NEW.col1 != 0
AND OLD.col1 = 0)
(.....)

Method_2
CREATE TRIGGER test
UPDATE OF col1 ON one
REFERENCING OLD AS deleted NEW AS inserted
FOR EACH ROW
(EXECUTE procedure);
In procedure, to do with the "IF..."

what difference between the Method_1 and Method_2, or you have a better way ?

Thanks a lot
Hi,
First metodo executes trigger without taking part, in metodo 2 one
takes part being able to add changes, even debugger.

Gustavo.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On