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;
The GETDATE() function returns the current database system date and time, in a 'YYYY-MM-DD hh:mm:ss. mmm' format.
GETDATE is a nondeterministic function. Views and expressions that reference this function in a column cannot be indexed.
The default date format is DD-MON-YY. SYSDATE is a function returning date and time. DUAL is a dummy table used to view SYSDATE. The default display and input format for any date is DD-MON-YY.
I think you want SYSDATE
, not GETDATE()
. Try it:
UPDATE TableName SET LastModifiedDate = (SELECT SYSDATE FROM DUAL);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With