Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle Problem from a beginner
Won't be possible, not even with a trigger, since it involves the table being modified. So you'll have to check it on the client side. For performance you might need an index on ref_nr + date_to (none on date_from: useless).
-- ------------ Kind reGards \ / | X | / \ x Gerard Chung Wing Tat Áéºa¹F <jliuws_at_hkstar.com> schreef in artikel <64mdg6$2673_at_lyra.hkstar.com>...Received on Mon Nov 17 1997 - 00:00:00 CST
> Hello every body!
>
> I am a beginner of Oracle in Hong Kong, I have a table which structures
> are listed as follows:
>
> ref_no varchar(8)
> date_from date
> date_to date
>
> I need to setup a constraint to this table to ensure that there is no
> overlapping date range in all rows so I want to setup following
constraint
> just example ) :
>
> alter table booking
> add constraint CHECK_DOBULE_BOOKING check ( not (
> ( date_to < ( select date_from from booking ) ) and
> ( date_from > ( select date_to from booking ) ) ) )
>
>
> I was prompted that Oracle doesn't support sub-query in this case. how
can
> I do it by table constraint? and how can I distinguish the field between
the
> newly added one and the one already inside the table when setup a
> constraint?
>
>
>
> Chung Wing Tat
> wtchung_at_writeme.com
>
> 16-Nov-1997
>
>
>
>
>