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: Deferrable Constraints

Re: Deferrable Constraints

From: DA Morgan <damorgan_at_psoug.org>
Date: Sat, 02 Dec 2006 09:49:06 -0800
Message-ID: <1165081745.107676@bubbleator.drizzle.com>


BigLearner wrote:
> Dear Friends,
>
> Can someone explain to me about deferable constraints? enable
> novalidate and others . Its really confusing for me.
>
> I am not so clear.
>
> Here is a question.
>
> create table prices
> (product_name varchar2(30),
> price number(10,4));
>
> Table created.
>
> alter table prices add constrint pk_prices_01
> primary key (product_name);
>
> Table altered;
>
> insert into prices values ('DOGGY', 499.99);
>
> 1 row created.
>
> alter table prices disable constraint pk_prices_01;
>
> Table altered.
>
> insert into prices values ('DOGGY' 449.99);
>
> 1 row created.
>
> alter table prices enable novalidate constraint pk_prices_01;
>
> What happens next?
>
> I just typed the question has I got the answer wrong so would like to
> know if someone can explain how it actually works. I thought It will
> not verify the existing entries but will verify the upcoming records
> but the answer was wrong.
>
> Thanks.
>
> Qurious to know the answer.
>
> I am held up as my desktop computer has got into some problem so I
> couldn't try them out myself. The question has nothing about deferable
> but I am confused about that too. Would be glad if someone can try to
> explain it to me.
>
> BigLearner

NOVALIDATE validates new entries ... not previously existing data.

To test it create a table.
Insert some data that will violate the constraint. Create the constraint.
Add new data that violates the constraint.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Sat Dec 02 2006 - 11:49:06 CST

Original text of this message

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