Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Trigger Question about the new and old
A copy of this was sent to "wls" <cuba_at_ms.chttl.com.tw>
(if that email address didn't require changing)
On Thu, 9 Dec 1999 13:10:06 +0800, you wrote:
>
>1 Can I use the new as a parameter of a PL/SQL procedure???
no, you must pass the individual components along.
You can use a small sqlplus script like:
set echo off
set verify off
set heading off
set feedback off
prompt Declare
prompt rowrec &1%rowtype;;
prompt begin
select chr(9) || 'rowrec.' || column_name || ' := :new.' || column_name || ';'
from user_tab_columns
where table_name = upper('&1')
/
prompt end;;
to generate the trigger body with a 'rowrec' variable that can be passed. for example:
tkyte_at_8.0> @test emp
Declare
rowrec emp%rowtype;
begin
rowrec.EMPNO := :new.EMPNO; rowrec.ENAME := :new.ENAME; rowrec.JOB := :new.JOB; rowrec.MGR := :new.MGR; rowrec.HIREDATE := :new.HIREDATE; rowrec.SAL := :new.SAL; rowrec.COMM := :new.COMM; rowrec.DEPTNO := :new.DEPTNO;
>2 Where is the description of new/old??
>
>
new and old are the after and before images of the entire row that was modified. triggers in general (and new and old) are described in the application developers guide.
>
>
>
>
--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Dec 09 1999 - 06:55:37 CST
![]() |
![]() |