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

Home -> Community -> Usenet -> c.d.o.server -> Re: table constraint

Re: table constraint

From: <fitzjarrell_at_cox.net>
Date: Mon, 25 Jun 2007 05:35:09 -0700
Message-ID: <1182774909.597609.85140@n60g2000hse.googlegroups.com>


On Jun 25, 6:41 am, mlynch147 <martin.ly..._at_raytheon.co.uk> wrote:
> Hi
>
> can someone tell me if this is possible.
>
> I would like to put a unique constraint on three columns of a table.
> one of the columns is a date/time field but i need the constraint to
> be +/- 3 mins of any data already in the table....
>
> eg, constraint on colour, direction, date columns
>
> colour = 1
> direction = 1
> date = June 25th 2007, 12pm
>
> If someone tries to enter another row with the values 1,1 and 12:00
> +/- 3 minutes, a unique constaint violation will happen....
>
> is this possible?
>
> thanks for any help you can provide....
>
> Marty

You can't 'constrain' a constraint like that. If any data is entered which is not an exact match for your existing key values it will be allowed in the table, period. There is no 'window' for datetime values you can enforce; if someone writes an insert using 1, 1 and sysdate as values all inserts will be acceptable and none will volate the key unless the system has millisecond response time and the exact same sysdate value is repeated.

The answer to your question is: No.

David Fitzjarrell Received on Mon Jun 25 2007 - 07:35:09 CDT

Original text of this message

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