Skip to Main Content

Oracle Database Discussions

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 to transform data

guest.kOct 10 2017 — edited Oct 10 2017

There is an application which is inserting 'Y' or 'N' into the database(Oracle 11g). But according to the standards we should have either 'T' or 'F' for all indicator fields. These indicator fields are null acceptable. This can be taken care at PL/SQL or at the service level. But I would like check the possibilities of enabling check constraint to insert 'T' when it is 'Y' and 'F' when it is 'N'

and I tried following which works but it will not transform any data and gives errors when it tries to insert 'Y' which is expected

ALTER TABLE palm.suppliers

ADD CONSTRAINT check_supplier_ind

  CHECK (supplier_ind IN ('T', 'F'));

I did some search to look at possibilities but I don't find what I am looking for. And it is mentioned that we cannot have sub query inside the check constraint.

I would like to know whether it is a valid scenario or not. If it is yes please let me know the possible ways.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 7 2017
Added on Oct 10 2017
2 comments
364 views