I am trying to add a constraint (in Oracle), that restricts the user from creating an entries having 'smth', 'smth else' or 'one more thing' in a field already exist. Basically, that's how I would write it:
ALTER TABLE sometable
ADD CONSTRAINT sometable_text_chk
CHECK (
caption IN (
SELECT caption
FROM sometable
WHERE text NOT IN ('smth', 'smth else', 'one more thing')
)
)
Unfortunately, it seems to be not allowed to nest queries for this occasion. Is there perhaps a workaround.
textandcaption? what do you mean when you say 'restricts the user from creating an entries ... in a field already exist'? (are you talking about wanting to have unique values in fieldcaption???)