Janjua
Janjua

Reputation: 29

Oracle Trigger Error for updating timestamp field before update & insert

I am creating a trigger on a Table Name ADM I added a field

UPD_DATETIME TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP NOT NULL;

Following is my trigger code

create or replace trigger TRG_UPD_DATETIME
 before insert or update
  on adm 
 FOR EACH ROW
  declare
begin
:NEW.UPD_DATETIME:=CURRENT_TIMESTAMP;
end TRG_UPD_DATETIME;

I am getting following error's when I am trying to compile:

Error(12): PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ; The symbol ";" was substituted for "end-of-file" to continue.

Upvotes: 0

Views: 315

Answers (1)

Ditto
Ditto

Reputation: 3344

Lose the DECLARE .. you don't need that in there.

http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#LNPLS99955

Upvotes: 1

Related Questions