Home » SQL & PL/SQL » SQL & PL/SQL » multiple "create trigger" commands in one script file
multiple "create trigger" commands in one script file [message #21239] Fri, 19 July 2002 04:48 Go to next message
dbvhelp
Messages: 1
Registered: July 2002
Junior Member
Hello,

I'd like to create ~35 trigger commands in one big SQL file, but Oracle can't correctly recognize any of the triggers. The triggers, entered alone, are correctly recognized and work.
It seems as if Oracle doesn't recognize the end of the first trigger command correctly and interprets the whole file as one big trigger - which of course results in failure.

How are CREATE TRIGGER commands properly closed? Here is an example of one of the triggers we use:

CREATE TRIGGER test_trigger
BEFORE INSERT ON test
FOR EACH ROW
BEGIN
SELECT test_seq.nextval INTO :new.id from dual;
END;
Re: multiple "create trigger" commands in one script file [message #21240 is a reply to message #21239] Fri, 19 July 2002 05:08 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
i would recomend to use

1. Create or replace trigger trigger_name.

2. if u are using many DDL's like this make sure u have a '/' to mark the end;

CREATE or replace TRIGGER test_trigger
  BEFORE INSERT ON test
  FOR EACH ROW
  BEGIN
  SELECT test_seq.nextval INTO :new.id from dual;
  END;
  /
  CREATE or replace TRIGGER or replace test_trigger
  BEFORE INSERT ON test
  FOR EACH ROW
  BEGIN
  SELECT test_seq.nextval INTO :new.id from dual;
  END;
  /
Re: multiple "create trigger" commands in one script file [message #21251 is a reply to message #21239] Fri, 19 July 2002 14:02 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
I know Mahesh's code has indenting just due to his formatting, but be aware that '/' must be in column 1 (i.e. don't indent it in your script).
Previous Topic: Problem with Decode Function used with Date
Next Topic: how to insert Blob values
Goto Forum:
  


Current Time: Tue Apr 23 21:42:30 CDT 2024