Trigger to mimic MySQL "last modified" datatype in Oracle
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;
Labels: 11g, command line, last modified, mysql, oracle, sql, sysadmin, systems administration, trigger
0 Comments:
Post a Comment
<< Home