Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Pass an entire Row to a stored Procedure from a Trigger
JB wrote:
> steph wrote:
>
> > JB wrote:
> > > Hi All,
> > >
> > > I'd like to do something that seems "simple" in PL/SQL, but
> > > somehow I haven't managed it.
> > > I'm writing code for an INSERT trigger, and I'd like to use the NEW and
> > > OLD special variables to pass them to a procedure.
...
> > Hi,
> >
> > AFAIK you can't pass ':NEW' as a record to a pl/sql procedure. I've
> > tried this once, and my workaround was declaring a rowtype in the
> > trigger, assign every ':NEW'-column to each column of the rowtype
> > variable, and pass this record to the called procedure. A bit painful
> > but it works.
...
Maybe use a cursor to produce the record insead?
In your trigger you could have:
cursor newRowcur is
select * from theTable
where primaryKey = :NEW.primaryKey;
newRow is theTable%ROWTYPE;
begin
open newRowcur;
fetch newRowcur into newRow;
close newRowcur;
proc_test(newRowcur);
...
end;
At least not have to specify all the columns individually.
Cheers
Chris
Received on Wed Jul 19 2006 - 09:22:48 CDT