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: Oracle 10g - Putting a where clause on a column with a check constraint.

Re: Oracle 10g - Putting a where clause on a column with a check constraint.

From: DA Morgan <damorgan_at_psoug.org>
Date: Wed, 22 Mar 2006 14:07:37 -0800
Message-ID: <1143065256.520874@yasure.drizzle.com>


Jon wrote:
> So I just tried this. And everything worked fine.
>
> Apperently just adding N infront of the values in the check constraint
> made oracle happy.
>
> create table jon5
> (
> AAA NVARCHAR2(1),
> BBB NVARCHAR2(10),
> CONSTRAINT CC_AAA CHECK(AAA IN(N'N',N'Y')),
> CONSTRAINT CC_BBB CHECK(BBB IN(N'Happy',N'Sad',N'Angry'))
> );
>
>
> insert into jon5 values('Y','Happy');
> insert into jon5 values('Y','Sad');
> insert into jon5 values('Y','Angry');
> insert into jon5 values('N','Sad');

Glad you got it.

I find it strange that this doesn't work though.

SELECT *
FROM jon5
WHERE aaa = CAST('Y' AS NVARCHAR2(1));

Would anyone know why?

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Wed Mar 22 2006 - 16:07:37 CST

Original text of this message

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