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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: create trigger after insert

RE: create trigger after insert

From: Suhen Pather <Suhen.Pather_at_strandbags.com.au>
Date: Thu, 01 Nov 2001 20:53:11 -0800
Message-ID: <F001.003BB0DD.20011101204020@fatcity.com>

<span

style='font-size:10.0pt;color:navy'>                THANKS,

<span style='font-size:

10.0pt;font-family:Arial;color:navy'> 

<span style='font-size:

10.0pt;font-family:Arial;color:navy'>            I resolved the issue.

<span style='font-size:

10.0pt;font-family:Arial;color:navy'>            If I use a script like the one below to test the trigger "for each row" and "statement insert"  it is
taken as multiple statements.

<span style='font-size:

10.0pt;font-family:Arial;color:navy'>           

<span style='font-size:

10.0pt;font-family:Arial;color:navy'>            It works fine now

<span style='font-size:

10.0pt;font-family:Arial;color:navy'> 

<span style='font-size:

10.0pt;font-family:Arial;color:navy'>            Regards

<span style='font-size:

10.0pt;font-family:Arial;color:navy'>            Suhen

<span style='font-size:

10.0pt;font-family:Arial;color:navy'>           

<span

style='font-size:10.0pt'> 

<span

style='font-size:10.0pt;font-family:Arial'>List,

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'>I am creating a trigger that should fire when records are inserted into a table TEST and should send an email via

<span

style='font-size:10.0pt;font-family:Arial'>utl_smtp.<span style='mso-spacerun:yes'>  The mailing is working fine.

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'>I am trying to get the trigger to fire after a group insert statement rather than each time a record is inserted.

<span

style='font-size:10.0pt;font-family:Arial'>I have not included the "for each row" syntax but it still fires after each row is inserted.

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'>Will the entry below be regarded as one insert statement if I put into a sql script and execute via sqlplus.

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'>insert into test values ('Suhen');

<span

style='font-size:10.0pt;font-family:Arial'>insert into test values ('Suhen');

<span

style='font-size:10.0pt;font-family:Arial'>insert into test values ('Suhen');

<span

style='font-size:10.0pt;font-family:Arial'>insert into test values ('Suhen');

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'>My create trigger syntax used:

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'>create or replace trigger test_trigger after insert on test

<span

style='font-size:10.0pt;font-family:Arial'>begin

<span

style='font-size:10.0pt;font-family:Arial'>send_mail ('Suhen','suhen.pather_at_strandbags.com.au','Insert','Records inserted into test');

<span

style='font-size:10.0pt;font-family:Arial'>end;

<span

style='font-size:10.0pt;font-family:Arial'>/

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'>I am busy looking through the docs for more info.

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'>Any help would be greatly appreciated.

<span

style='font-size:10.0pt;font-family:Arial'> 

<span

style='font-size:10.0pt;font-family:Arial'>Regards

<span

style='font-size:10.0pt;font-family:Arial'>Suhen

<span

style='font-size:10.0pt;font-family:Arial'>  Received on Thu Nov 01 2001 - 22:53:11 CST

Original text of this message

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