PL/SQL (MOSC)

MOSC Banner

Constraint forcing at least one child to exist and check constraint using table values

edited Sep 5, 2013 2:23AM in PL/SQL (MOSC) 6 commentsAnswered
I have added referential integrity and constraints to tighten up the schema data processing and have questions after some researching.

 

1. Can I add a value validation constraint with record selection?  I researched how you can have a constraint to only allow certain "hard coded values" but can't find an example based on table values like below.  I did see that sub queries are not allowed so I am guessing that is why, but I certainly wouldn’t want to hard code 100s of values.

 

ALTER TABLE SCHEMA.PATIENT ADD

CONSTRAINT PATIENT_C01

 CHECK (pat_field IN (SELECT table_id FROM lookup_table where table_type = 'values_1'))

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center