Bind variables in trigger
Date: Thu, 24 Jun 1999 13:10:29 +0200
Message-ID: <7kt3lr$o2$1_at_diana.bcn.ttd.net>
Hola,
Tengo un problema con una sentencia dinámica en un trigger.
Necesito usar los registros :new y :old en una sentencia dinámica y Oracle
los trata como si fueran bind variables. Se utiliza esta sentencia en una
auditoría
parametrizable de columnas de tablas.
Hi,
I have a problem with a dynamic sentence in a trigger.
I need to use the :new and :old pseudo-records in a dynamic sentence but
Oracle
manages this ones like bind variables.
This process is used for audit changes in table columns pre-defined by user
in
configuration options.
Help me, please.
CREATE OR REPLACE TRIGGER trigger_name
AFTER UPDATE ON table_name
REFERENCING OLD as old_reg
NEW as new_reg
FOR EACH ROW
.
.
.
/* Column in process: */
ls_CurrCol := ...; -- retrieved from a Cursor of current table updateable
columns
.
.
.
ls_SQL := 'INSERT INTO A_AUDITS
(col1, col2, col_auditing, old_value, new_value) VALUES (' ;
ls_SQL := ls_SQL || ':data1, ''YYY'', ''' || ls_CurrCol ; ls_SQL := ls_SQL || ''', :old_reg.' || ls_CurrCol || ', :new_reg.' || ls_CurrCol || ')' ;
.
.
.
open_cursor ...
parse ...
bind_variable (ln_Cursor, ':data1', ls_XXX) ; execute ...
.
.
.
Cuando se actualiza la columna en la tabla que se quiere auditar y se ejecuta el
trigger, este lanza la sentencia que se ha formado en la sentencia dinámica y se
produce el error "ORA-01008: No todas las variables han sido transferidas" pero
creo que :old y :new no son bind variables. ¿Que puedo hacer?
When i update a column in the table and jump the trigger, it fails because "ORA-01008: not all variables bound",
but ":old_reg.XX"/"new_reg.XX" aren't bind variables!! (only ":data1" is)
HelppppppppppppppppReceived on Thu Jun 24 1999 - 13:10:29 CEST