Discussion:
ORA-00900: invalid SQL statement on CREATE TRIGGER
(too old to reply)
Joe Seeley
2017-04-25 17:22:20 UTC
Permalink
I'm trying to create a before insert or update trigger that would update a timestamp any time an update is made to a table. The following is my query, but this is giving an invalid SQL statement error.

CREATE OR REPLACE TRIGGER "SCHEMA".TRIGGER_NAME"
BEFORE INSERT OR UPDATE ON SCHEMA.TABLENAME
FOR EACH ROW
BEGIN
:new.LASTMODIFIED := sysdate;
END;
/
Kay Kanekowski
2017-04-26 08:31:20 UTC
Permalink
Hi Joe,
is this only a typo here "SCHEMA".TRIGGER_NAME" - there is missing " before TRIGGER_NAME.

i do this and it works:

create table kk1 ( wert number, LASTMODIFIED date, lastuser varchar2(100));

CREATE OR REPLACE TRIGGER scott.T1
BEFORE INSERT OR UPDATE ON scott.kk1
FOR EACH ROW
BEGIN
:new.LASTMODIFIED := sysdate;
:new.LASTUSER := user;
END;
/

regards
Kay

Continue reading on narkive:
Search results for 'ORA-00900: invalid SQL statement on CREATE TRIGGER' (Questions and Answers)
3
replies
Oracle sql constraint subquery?
started 2011-11-23 12:15:50 UTC
programming & design
Loading...