Originally Posted by
Virusble
Hello guys I'm new to the forum!
Welcome!
Originally Posted by
Virusble
Anyone know how to make a trigger that doesn't allow delete departments in the next 3 months?
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:
Code:
IF :OLD.created > ADD_MONTHS(SYSDATE, -3)
THEN
raise_application_error( -20001, 'Can not delete record, the data is too new' );
END IF;
Now you just need to build a trigger around that logic.