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

Home -> Community -> Usenet -> c.d.o.tools -> Calling Procedures Within Triggers

Calling Procedures Within Triggers

From: <stevetorch_at_my-deja.com>
Date: Tue, 29 Aug 2000 23:32:35 GMT
Message-ID: <8ohh6j$ic3$1@nnrp1.deja.com>

Hi

I am trying to come up with a way to insert new records into a table using a trigger. The problem is data that I need comes from more than one table. Is there a way to join tables in a trigger or should I use a trigger that runs a procedure?

if procedure is the way to go then below is the code that i have but i just can't make it work. when it says parameters what Parameters is it talking about?

any info is very appreciated
thank you very much
Steve

Create or replace trigger theTrigger
before [or after] .....on tableName
declare
begin
procedure_name(parameters);
end;
/

create or replace procedure procedure_name is
cursor my_cursor is select some_column, another_column, more_columns from table1, table2
where table1.value = table2.value order by optional_sort_column;

begin

  for rec1 in my_cursor Loop
   insert into tablez (col1, col2, col3) values(rec1.some_column, rec1.another_column, rec1.more_columns);  end loop;
end;
/

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Tue Aug 29 2000 - 18:32:35 CDT

Original text of this message

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