Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Constraint based on sysdate
Hi Brian:
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;
/
--
David C. Sisk
The Unofficial ORACLE on NT site
http://www.ipass.net/~davesisk/oont.htm
Brian Howard wrote in message <3796623B.A7F88D82_at_creditwatch-inc.com>...
>I want to put a check constraint on a field in the database which is
>based on the sysdate (ex. sysdate minus 15 years). It says that I cannot
>use sysdate in a check constraint. Is this true and how can I do it?
>
Received on Wed Jul 21 1999 - 21:28:49 CDT
![]() |
![]() |