DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: How to get the Current Action in upd/del trigger

  1. #1
    Join Date
    Mar 2002
    Location
    Mesa, Arizona
    Posts
    1,204

    How to get the Current Action in upd/del trigger

    How do you reference the trigger action in an insert to another table ("INSERTING", "UPDATING", or "DELETING")?

    For example:

    insert into audit_table ld.col1, :new.col1, [ACTION], ...

    Currently I've got 3 "IF [ACTION]" statements that set a varable and the var is set then used in the audit insert. Just thinking there's got to be a more elegant way to do this.

    Thanks,

    Ken
    "I do not fear computers. I fear the lack of them." Isaac Asimov
    Oracle Scirpts DBA's need

  2. #2
    Join Date
    Mar 2002
    Location
    Mesa, Arizona
    Posts
    1,204
    Well, at least I learned that ":" and an "o" make a cool purple face...
    "I do not fear computers. I fear the lack of them." Isaac Asimov
    Oracle Scirpts DBA's need

  3. #3
    Join Date
    Jun 2006
    Posts
    259
    You could create 3 seperate triggers, one for each action.
    AFAIK, your test method is about the only way to do that.

    Good luck,
    Ken

  4. #4
    Join Date
    Nov 2006
    Location
    Sofia
    Posts
    630
    Guys,
    You are wasting your time.
    Do you realize that here we discuss is there a way to write 3 statements instead of 5.
    I know you can say now that if ANOTHER statement appear then the trigger will not work correctly, but for almost 30 years existence of Oracle on the market, these statements have not changed so I would take that risk if I was you.

Posting Permissions

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


Click Here to Expand Forum to Full Width