Home » SQL & PL/SQL » SQL & PL/SQL » Problem With a Data Base Trigger Creation
Problem With a Data Base Trigger Creation [message #39928] Sat, 24 August 2002 08:45 Go to next message
Robinson
Messages: 5
Registered: August 2002
Junior Member
Look, i've the next commands in a Data Base triger:

DECLARE
CURSOR AUD IS
Select column_name columna from user_tab_columns
Where table_name ='ZONA';
campo varchar2(30);
campo1 varchar2(30);
cadena varchar2(400);

Begin

For a in aud loop
campo:=a.columna;
campo1:=':new.'||campo;
cadena := cadena ||campo||': '||campo1 ||', ';
End loop;

Insert into borrar(cad) values (cadena);

END LOGO1;

What i wish is insert in a table all the news value fields to audit when i insert a row, but i got the problem with ':new.'||campo because i need that the PL/SQL don`t take it as a character string, i need insert is the :new.codzon value not the ':new.codzon'
string.

Help me please !! does anyone give me a idea ?
Re: Problem With a Data Base Trigger Creation [message #39930 is a reply to message #39928] Sat, 24 August 2002 12:37 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
You cannot dynamically refer to the :new values this way. Your best option is to use dynamic SQL to create your trigger code for you, but the actual final code will need to refer to all of the discrete :new values.
Previous Topic: Interesting questions
Next Topic: Installation problem
Goto Forum:
  


Current Time: Fri Apr 26 10:01:34 CDT 2024