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!

Trigger issue

Discussion in 'SQL PL/SQL' started by rahulkadam, Jul 11, 2009.

  1. rahulkadam

    rahulkadam Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    Hi All,

    Can you please help with the below trigger.. I am trying to copy rows from AES_CONFIG_CLIENTVWAPDEFAULTS table to aes_config_vwapdefaults_bak before a row is deleted from AES_CONFIG_CLIENTVWAPDEFAULTS. I am trying to use a "*" so taht when the table structure of AES_CONFIG_CLIENTVWAPDEFAULTS i do not have to change the trigger. I will be definitely changiing aes_config_vwapdefaults_bak table structure.

    Below trigger is giving two errors...

    Line 2 - PL/SQL : SQL Statement Ignored
    Line 3 - ORA-00936 : missing expression
    Code (Text):

    CREATE OR REPLACE TRIGGER IN_AES01.TGR_AES_VWAPDEFAULTS_DL
    before DELETE
    ON IN_AES01.AES_CONFIG_CLIENTVWAPDEFAULTS
    REFERENCING OLD AS OLD NEW AS NEWROW
    FOR EACH ROW
    BEGIN
    insert into aes_config_vwapdefaults_bak values
    select ( 'DELETE', sysdate, user,
    * from OLD);
    END tgr_aes_vwapdefaults_dl;
    /
    Can someone plesae advise.

    -rahul
     
  2. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    Code (SQL):

    CREATE OR REPLACE TRIGGER IN_AES01.TGR_AES_VWAPDEFAULTS_DL
    BEFORE DELETE
    ON IN_AES01.AES_CONFIG_CLIENTVWAPDEFAULTS
    REFERENCING OLD AS OLD NEW AS NEWROW
    FOR EACH ROW
    BEGIN
    INSERT INTO aes_config_vwapdefaults_bak
    SELECT  'DELETE', sysdate, USER,
    tbl.* FROM IN_AES01.AES_CONFIG_CLIENTVWAPDEFAULTS  tbl WHERE rowid= OLD.rowid;
    END tgr_aes_vwapdefaults_dl;
    /
     
    code not tested.....