ALTER TABLE YOUR_TABLE ADD (LAST_MODIFIED DATE);
CREATE OR REPLACE
TRIGGER YOUR_TABLE_BEFORE_INS_UPD BEFORE INSERT OR UPDATE
ON YOUR_TABLE
FOR EACH ROW
DECLARE CURRENT_TIME DATE;
BEGIN
CURRENT_TIME := SYSDATE;
:new.last_modified := CURRENT_TIME;
END;
Monday, September 22, 2008
Trigger to mimic MySQL "last modified" datatype in Oracle
Labels:
11g,
command line,
last modified,
mysql,
oracle,
sql,
sysadmin,
systems administration,
trigger
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment