Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    1

    Unanswered: 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

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780

    Re: how to migrate oracle trigger into informix

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •