Why is the GETDATE() an invalid identifier says Oracle Sql Developer tool when I debug this code:
CREATE OR REPLACE TRIGGER SPName
AFTER UPDATE
ON TableName
FOR EACH ROW
BEGIN
UPDATE TableName SET LastModifiedDate = GETDATE() WHERE TableName.DET_ID = :new.DET_ID;
END;
Use ORACLE equivalent of getdate()
which is sysdate
. Read about here.
Getdate() belongs to SQL Server , will not work on Oracle.
Other option is current_date
getdate()
for MS-SQL, sysdate
for Oracle server
SYSDATE
and GETDATE
perform identically.
SYSDATE
is compatible with Oracle syntax, and GETDATE
is compatible with Microsoft SQL Server syntax.
Source: Stackoverflow.com