1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

how to create trigger if table has attribute name "END"

Discussion in 'SQL PL/SQL' started by amit_bdn2, Oct 21, 2010.

  1. amit_bdn2

    amit_bdn2 Guest

    Hello,

    Thanks for your time first.

    Well, I have a table in database which is having one attribute with the name "END".

    Now if I try to create trigger on this table, using all attributes than its gives error cos "END" is reserved keyword for Oracle trigger/procedure.

    Please can you suggest a solution/workaround to fix this without making any change in the database design.


    Regards

    Amit Sharma
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,347
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    You need to post the table description and the trigger code that is failing as I have no problems creating such a trigger:

    Code (SQL):
     
    SQL> CREATE TABLE trigtest(
      2  id NUMBER,
      3  nme        varchar2(20),
      4  strt       DATE,
      5  END        DATE
      6  );
    TABLE created.
    SQL>
    SQL> CREATE TRIGGER set_end
      2  BEFORE INSERT OR UPDATE ON trigtest
      3  FOR each ROW
      4  BEGIN
      5          IF :NEW.strt IS NOT NULL THEN
      6                  :NEW.END := sysdate;
      7          END IF;
      8  END;
      9  /
    TRIGGER created.
    SQL>
    SQL> SHOW errors
    No errors.
    SQL>