Home » SQL & PL/SQL » SQL & PL/SQL » Referencing an entire row in a trigger
Referencing an entire row in a trigger [message #21433] Fri, 02 August 2002 07:55 Go to next message
SteveL
Messages: 1
Registered: August 2002
Junior Member
I would like to pass an entire row to a stored procedure, but I don't know how to reference it. I can pass individual fields via :new.fieldname, but how do I pass the entire 'new' or 'old' row?
Re: Referencing an entire row in a trigger [message #21435 is a reply to message #21433] Fri, 02 August 2002 10:33 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Unfortunately, you can't just:

select *
  into r_emp
  from emp
 where empno = :new.empno;


without running into mutating table issues. The only alternative is to:

r_emp.empno := :new.empno;
r_emp.ename := :new.ename;
...
r_emp.deptno := :new.deptno;


and then:

some_proc(r_emp);


You are passing one parameter to the proc, but even then have had to assign each of the columns specifically. So, you won't be able to avoid the column references in either approach, the other obviously being:

some_proc(:new.empno, :new.ename, ...);
Previous Topic: IF Condition in SQL Query?
Next Topic: Suppress (ie, '_%') from a column within a table.
Goto Forum:
  


Current Time: Thu Apr 25 11:24:25 CDT 2024