Board index » delphi » Cannot create triggers on an Oracle database: HELP

Cannot create triggers on an Oracle database: HELP

I cannot create triggers on oracle database.  For every trigger I create I
get a Warning: Trigger created with compilation errors, and when I try to
run the trigger I get a ORA-04098: trigger 'TRIGGER1' is invalid and failed
re-validation.  In fact I can see the trigger with the database explorer, I
mean, the trigger is created but doesn't run.

I don't think it is due a compilation error, because I cannot even create
simple triggers like:

 CREATE TRIGGER TRIGGER1 BEFORE INSERT ON SESSIONS FOR EACH ROW
 BEGIN
    :NEW.IDSESSION = 1;
 END;

Can it be a problem with my oracle? Any tip will be welcome!!!

Tnx

 

Re:Cannot create triggers on an Oracle database: HELP


Gabriel,

What tool are you using to create your triggers? I noticed your other post,
("Triggers on Oracle") and it seems you have had a wrong start.

Anyway, if you're using SQL PLUS then try :

Show Errors

and see where exactly your trigger is failing. Although the messages are
not very informative sometimes, they always give you the line and column
the error occured so that you can figure out the rest. Your "simple"
trigger gives the following error.

LINE/COL ERROR
-------- -----------------------------------------------------------------
2/20     PLS-00103: Encountered the symbol "=" when expecting one of the
         following:
         := . ( @ % ; indicator
         The symbol ":= was inserted before "=" to continue.

It's quite obvious that you used a '=' in the place of ':='.

Now, if you use some other tool, you can always do :

select * from user_errors where Name='YOUR_TRIGGER_IN_CAPITALS'

HTH.

Quote
"Gabriel" <gabr...@projuris.com.br.nospam> wrote:
>I cannot create triggers on oracle database.  For every trigger I create I
>get a Warning: Trigger created with compilation errors, and when I try to
>run the trigger I get a ORA-04098: trigger 'TRIGGER1' is invalid and failed
>re-validation.  In fact I can see the trigger with the database explorer, I
>mean, the trigger is created but doesn't run.

>I don't think it is due a compilation error, because I cannot even create
>simple triggers like:

> CREATE TRIGGER TRIGGER1 BEFORE INSERT ON SESSIONS FOR EACH ROW
> BEGIN
>    :NEW.IDSESSION = 1;
> END;

>Can it be a problem with my oracle? Any tip will be welcome!!!

>Tnx

Elias Tsiotsias
DataFX Software

Re:Cannot create triggers on an Oracle database: HELP


have you tried another tablename, maybe SESSIONS is a reserved Word from
Oracle, BDE or DELPHI.

bye
Stephan

Gabriel <gabr...@projuris.com.br.nospam> schrieb in im Newsbeitrag:
7qetnd$7...@forums.borland.com...

Quote
> I cannot create triggers on oracle database.  For every trigger I create I
> get a Warning: Trigger created with compilation errors, and when I try to
> run the trigger I get a ORA-04098: trigger 'TRIGGER1' is invalid and
failed
> re-validation.  In fact I can see the trigger with the database explorer,
I
> mean, the trigger is created but doesn't run.

> I don't think it is due a compilation error, because I cannot even create
> simple triggers like:

>  CREATE TRIGGER TRIGGER1 BEFORE INSERT ON SESSIONS FOR EACH ROW
>  BEGIN
>     :NEW.IDSESSION = 1;
>  END;

> Can it be a problem with my oracle? Any tip will be welcome!!!

> Tnx

Re:Cannot create triggers on an Oracle database: HELP


Maybe this wil help:

CREATE TRIGGER TRIGGER1 BEFORE INSERT ON SESSIONS FOR EACH ROW
 BEGIN
    SELECT 1 INTO  :NEW.IDSESSION  FROM  DUAL;
END;

Gabriel <gabr...@projuris.com.br.nospam> schreef in berichtnieuws
7qetnd$7...@forums.borland.com...

Quote
> I cannot create triggers on oracle database.  For every trigger I create I
> get a Warning: Trigger created with compilation errors, and when I try to
> run the trigger I get a ORA-04098: trigger 'TRIGGER1' is invalid and
failed
> re-validation.  In fact I can see the trigger with the database explorer,
I
> mean, the trigger is created but doesn't run.

> I don't think it is due a compilation error, because I cannot even create
> simple triggers like:

>  CREATE TRIGGER TRIGGER1 BEFORE INSERT ON SESSIONS FOR EACH ROW
>  BEGIN
>     :NEW.IDSESSION = 1;
>  END;

> Can it be a problem with my oracle? Any tip will be welcome!!!

> Tnx

Re:Cannot create triggers on an Oracle database: HELP


Assignment operator is :=, not =

Quote
Gabriel <gabr...@projuris.com.br.nospam> wrote in message

news:7qetnd$70p8@forums.borland.com...
Quote
> I cannot create triggers on oracle database.  For every trigger I create I
> get a Warning: Trigger created with compilation errors, and when I try to
> run the trigger I get a ORA-04098: trigger 'TRIGGER1' is invalid and
failed
> re-validation.  In fact I can see the trigger with the database explorer,
I
> mean, the trigger is created but doesn't run.

> I don't think it is due a compilation error, because I cannot even create
> simple triggers like:

>  CREATE TRIGGER TRIGGER1 BEFORE INSERT ON SESSIONS FOR EACH ROW
>  BEGIN
>     :NEW.IDSESSION = 1;
>  END;

> Can it be a problem with my oracle? Any tip will be welcome!!!

> Tnx

Other Threads