Skip to content
Advertisement

How to add column with specific condition for oracle DB

How do add a field – DOC with Date type to the Registration table. Also DOC (Date of Completion) should be greater than DOJ (Date of joining).

I wrote this query but it is showing error : Column check constraint cannot reference other column

Advertisement

Answer

Add both the DOC column and the CHECK constraint with a single ALTER TABLE statement (see DBfiddle here) :

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement