Hello guys Im new to the forum!
Anyone know how to make a trigger that dont allow delete deparments in the next 3 months?
Thanks :(
Printable View
Hello guys Im new to the forum!
Anyone know how to make a trigger that dont allow delete deparments in the next 3 months?
Thanks :(
Welcome!
Yes. If you want help writing a trigger, you should provide a definition of you table, the date column
used to prevent deletes. Do you mean prevent deletes three months from now, or do you mean prevent
deletes for three months after the row has been inserted? You will get significantly more useful information
if you can describe your question with as much detail as possible.
You probably want some logic along the lines of this:
Now you just need to build a trigger around that logic. ;)Code:IF :OLD.created > ADD_MONTHS(SYSDATE, -3)
THEN
raise_application_error( -20001, 'Can not delete record, the data is too new' );
END IF;