Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2004
    Posts
    1

    Unanswered: Insert Log table

    Hello, what I am doing is using a program I didn't write and trying to figure out exactly how it is accessing the DB. I have never really used PL/SQL that much so I would like some help if possible. I would like to put a trigger on each table to record the action done to it.
    I have created a table (LOG_TABLE)with a field for the table name that was accessed, the time it was accessed, the sequence number of the newly inserted row(or updated/deleted row), and the name of the action(insert, update, delete).

    What I don't know how to do is to get the sequence number(PK) of the newly inserted row. I know I can simply get it from the inserted table but if someone could help me with the PL/SQL code I would really appreciate it. Thanks.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    In the trigger, you can get the primary key value like this:

    :new.pkcol - for insert or update
    :old.pkcol - for update or delete

    (change "pkcol" to the real column name).

Posting Permissions

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