Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Dynamically referencing fieldnames in table trigger

Dynamically referencing fieldnames in table trigger

From: Fraser Boswell <Fraser.Boswell_at_spamme.ed.ac.uk>
Date: Wed, 18 Aug 1999 09:27:50 +0100
Message-ID: <37BA6E86.6E9D141E@spamme.ed.ac.uk>


Tried badly to explain myself last time so I'll try again. Here's the code body for an After Update Trigger

Begin
  declare
    cursor c is

      select colname
      from my_table_columns
      where tablename = 'MY_TABLE'
      and auditflag = 'Y'; -- so cursor c brings back a list of all
                --fieldnames to be checked in case they have been
updated

    currcolname table_columns.colname%type; -- to hold the field name   begin
    for my_rec in c
    loop

Now if currcolname is Surname I need the line to read

   if :NEW.Surname != :OLD.Surname then instead of currcolname. So the IF statement needs to be dynamic. Any ideas

Thanks in advance

Fraser Received on Wed Aug 18 1999 - 03:27:50 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US