Re: Constraint based on sysdate

From: DanHW <danhw_at_aol.com>
Date: 23 Jul 1999 03:38:15 GMT
Message-ID: <19990722233815.02196.00000178_at_ng-ft1.aol.com>


>You can't use a constraint, but you can use a trigger to do it.
>
>CREATE TRIGGER.......
>.......
>SELECT sysdate INTO v_sysdate FROM dual; --Put the sysdate into a variable
>IF date_column != v_sysdate -- Compare the values
> RAISE_APPLICATION_ERROR(-20000, 'You cannot use this date'); --
>Disallow the transaction
>END IF;
>....
>END;
>/
>
>

You don't need to select sysdate from dual, you can use it directly...

if sysdate - 15*365 < :new.date_column then

   raise_application_error (-20001, ' Date cannot be before '||to_char(sysdate-15*365));
end if;

Dan Received on Fri Jul 23 1999 - 05:38:15 CEST

Original text of this message