Re: triggers
Date: 1996/01/31
Message-ID: <4eogtv$54m_at_inet-nntp-gw-1.us.oracle.com>#1/1
In article <Pine.HPP.3.91.960131124333.5261D-100000_at_mailgate>, Heather Dyson <dyson_at_template.com> writes:
|> 
|> I need to create a trigger in the database but
|> it doesn't seem to be accepting it. I am using
|> sqlplus. Can anyone tell me where I am going
|> wrong?
|> 
|> CREATE TRIGGER update_trig
|> BEFORE 
|> UPDATE
|> ON table
|> BEGIN
|>    INSERT INTO table2
|>         VALUES(new.field, 1);
|> END update_trig;
|> 
|> Sqlplus just waits for more input.
|> 
|> Thanks,
|> Heather
You need a slash after the END line, which tells SQL*Plus to run the 
block you've just typed in.  Also a colon in front of :new.field:
CREATE TRIGGER update_trig
  BEFORE UPDATE ON table
BEGIN
  INSERT INTO table2
    VALUES (:new.field, 1);
END update_trig;
/
Received on Wed Jan 31 1996 - 00:00:00 CET
