Re: Need Help with Trigger

From: Jared Still <jared_at_valleynet.com>
Date: 1996/01/11
Message-ID: <4d3ecn$6vl_at_alpine.valleynet.com>#1/1


gdouglas_at_mailhost.wlc.com (Gerry Douglas) wrote:

>Hi, I've just started learning Oracle and I have some problem creating trigger.
>Basically, I typed in something like this in PL/SQL:
 

> >create trigger trig_test
> 2 after insert or update
> 3 on tab1
> 4 begin
> 5 select * from tab1;
> 6 end;
> 7 .
 

>Upon hitting enter, no message is displayed and a PL/SQL prompt is returned.
>After that, when I perform an insert, nothing from tab1 is displayed; only
>confirmation message that a row has been inserted. When I perform a select *
>from sys.user_triggers, the table is empty. (If I had successfully created a
>trigger, the trigger info will be stored in this table, right?)
>What did I do wrong?
 

>I sincerely thank anyone who may be able to help.
 

>Gerry

  1. the code 'select * from tab1;' is not legal code in a trigger. It must be PL/SQL code. A select must be into a variable or the definition of a cursor.
  2. you must enter a '/' on a line by itself to execute the code to create the trigger.

Please read the PL/SQL manual, cover to cover. Yes, it's a lot, but it's necessary if you want to be good at this.

An excellent book is Steven Feursteins "ORACLE PL/SQL Programming" from O'Reilly.

Jared Still, Oracle DBA
RxNet, Division of Value Health
"All opinions are mine, not my employers" jared_at_valleynet.com Received on Thu Jan 11 1996 - 00:00:00 CET

Original text of this message