Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Pass an entire Row to a stored Procedure from a Trigger

Re: Pass an entire Row to a stored Procedure from a Trigger

From: <chris.hulan_at_gmail.com>
Date: 19 Jul 2006 07:22:48 -0700
Message-ID: <1153318968.145315.198870@i3g2000cwc.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US