PROBLEM:
While dropping a column, got the below error.
SQL> ALTER TABLE dbaclass.EMPLIST DROP (empname); ALTER TABLE dbaclass.EMPLIST DROP (empname) * ERROR at line 1: ORA-12991: column is referenced in a multi-column constraint
SOLUTION:
If the column is part of a multi-column constraint, then we have to drop all the columns of that constraint. Dropping a single column will throw an error.
1. Check whether the column is part of Multi-column constraint or not.
SQL> select COLUMN_NAME,CONSTRAINT_NAME,POSITION from dba_cons_columns where table_name='EMPLIST'; COLUMN_NAME CONSTRAINT_NAME POSITION ------------- --------------- ---------- EMPNAME EMP_PK 1 EMPNUM EMP_PK 2
We can that the constraint EMP_PK has two columns.
2. So the only option is to drop both the columns.
SQL> ALTER TABLE dbaclass.EMPLIST DROP (empname,empnum); Table altered.