This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,798 Users
  • 2,269,775 Discussions
  • 7,916,823 Comments

Discussions

Weird error using :new in trigger

752032
752032 Member Posts: 26
edited Feb 7, 2010 2:49PM in SQL & PL/SQL
Hi buddies:

I'm using 10g and I've created an after insert trigger:

CREATE OR REPLACE TRIGGER "TR_INSERT_PERSON" AFTER
INSERT ON "PERSON" FOR EACH ROW BEGIN
INSERT INTO CHANGETABLE (ROWGUID, OPERATION, DATEOPERATION, TABLEID) VALUES (:NEW.UUID, 2, SYSDATE, 'PERSON');
END;

When I apply, it shows me the error message: "Missing IN or OUT parameter at index:: 1"
I know the cause of the error is the ':NEW' parameter, because when I replace it with a value it works, but I'm on a trigger body, what's wrong?

Thanx a lot in advance.

Best Answer

  • Solomon Yakobson
    Solomon Yakobson Member Posts: 20,213 Red Diamond
    Answer ✓
    Try the following in SQL*Plus:
    CREATE OR REPLACE
      TRIGGER KIKO.TR_INSERT_PERSON
        AFTER INSERT
        ON KIKO.PERSON
        FOR EACH ROW
        BEGIN 
            INSERT
              INTO CHANGETABLE(
                               ROWGUID,
                               OPERATION,
                               DATEOPERATION,
                               TABLEID
                              )
              VALUES (
                      :NEW.UUID,
                      2,
                      SYSDATE,
                      'PERSON'
                     );
    END;
    /
    SHOW ERRORS TRIGGER KIKO.TR_INSERT_PERSON
    SY.
«1

Answers

This discussion has been closed.