Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Constraint based on sysdate

Re: Constraint based on sysdate

From: David Sisk <davesisk_at_ipass.net>
Date: Wed, 21 Jul 1999 22:28:49 -0400
Message-ID: <tcvl3.3$tp2.35@news.ipass.net>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US