Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Check constraint with NULL

Rosario VigilanteSep 15 2018 — edited Sep 15 2018

Hello to all

where I am wrong

in this one ( I have to check no rows can INSERT with column FCOL1 = 'R' can have FCOL2 = null,

ALTER TABLE table_a

ADD  CONSTRAINT chk_FDELETE

  CHECK (FCOL1= 'R' and FCOL2 is null);

I get

ORA-02293: cannot validate (ORACLE_RV.CHK_FDELETE) - check constraint violated

but when I do

select count(*) from table_a

where FDELETE = 'R' and ANNO_RICO is null;

I get 0 rows (zero

Where I am wrong?

Thanks in advance

This post has been answered by Solomon Yakobson on Sep 15 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 13 2018
Added on Sep 15 2018
8 comments
2,486 views