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: Q: How do I avoid overlapping values?

Re: Q: How do I avoid overlapping values?

From: Bjørn Augestad <b-augest_at_online.no>
Date: Thu, 03 Jun 1999 12:57:09 +0200
Message-ID: <37565F85.E92751DB@online.no>

Steven Hauser wrote:
>
> Try check constraints. They can be deferred so a large insert or update can
> be checked at the end of your transaction.
> --
> ---------------------------------------------------------
> Steven Hauser
> email: hause011@tc.umn.edu URL: http://www.tc.umn.edu/~hause011
> ---------------------------------------------------------

AFAIK I can't use check constraints, since check's only validates one row. I have to verify that on existing rows in the table has a date span that contains one or more dates from the new row. Something like this

	select count(*) into cOverlappingRows
	from foo
	where dateFrom <= :new_dateTo
	and dateTo >= :new_dateFrom;

	if cOverlappingRows > 0 then
		overlap_error ...
	end if;

I have a feeling that this may be too slow for our needs, but I'm stumped... Bjørn Received on Thu Jun 03 1999 - 05:57:09 CDT

Original text of this message

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