Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle 10g - Putting a where clause on a column with a check constraint.
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