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

Home -> Community -> Usenet -> c.d.o.server -> Re: How do I terminate a trigger declaration in an SQL file?

Re: How do I terminate a trigger declaration in an SQL file?

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Tue, 3 Aug 1999 21:04:56 +0200
Message-ID: <MPG.12115bc18200189c989682@news.demon.nl>


In article <37A73137.A6AD4175_at_fast.no>, kevin.porter_at_fast.no says...
> The subject says it really.
>
> If I have a section of code in a .sql file, for example:
>
> --start code----------
> create or replace trigger trig1
> before insert on webtab1
> for each row
> begin
> select seq1.nextval
> into :new.id
> from dual;
> end;
>
> commit;
> --end code------------
>
> then I run the code in svrmgrl:
>
> SVRMGR> @create_demo.sql
>
> I get this error:
>
> MGR-00072: Warning: TRIGGER TRIG1 created with compilation errors.
>
> Then if I do a 'show errors' I get:
>
> Errors for TRIGGER TRIG1:
> LINE/COL ERROR
> --------------------------------------------------------------------------------5/1
> PLS-00103: Encountered the symbol "COMMIT"
>
>
> So, how do I terminate the create trigger function?
>
> Thanks,
>
> - Kev
>
>

The correct code is
create or replace trigger trig1
before insert on webtab1
for each row
begin

   select seq1.nextval
   into :new.id
   from dual;
end;
/

Using commit is NOT allowed in a trigger. Consult the application developers guide for further detail. If you don't have it, all the docs are available at http://technet.oracle.com. You need to subscribe but that's free.

Hth,

Sybrand Bakker, Oracle DBA Received on Tue Aug 03 1999 - 14:04:56 CDT

Original text of this message

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