hi
There is a table with rows , with one column as NOT NULL constratint.
I want to add unique key constraint in that column
can u please provide me syntax.
Printable View
hi
There is a table with rows , with one column as NOT NULL constratint.
I want to add unique key constraint in that column
can u please provide me syntax.
This should help
RegardsCode:ALTER TABLE table_name
ADD CONSTRAINT constraint_name
UNIQUE (column_name)
Hi,
use:
ALTER TABLE
ADD CONSTRAINT
UNIQUE ();
example:
ALTER TABLE EMP ADD CONSTRAINT EMP_NO_UNQ UNIQUE (EMPNO);
Cheers,
R.
hi all i am getting this error vcan any one help me out.
ALTER TABLE PRONTO_WISP ADD CONSTRAINT WPNAME_UN UNique(WISP_NAME)
*
ERROR at line 1:
ORA-02299: cannot validate (WINTER02.WPNAME_UN) - duplicate keys found
You are trying to create UNIQUE constraint on column WISP_NAME, but it has duplicate contents.
Above sql stmt will give you duplicate records for WISP_NAME. You need to delete duplicate entries prior to creating constraint.Code:SELECT * FROM pronto_wisp
WHERE ROWID NOT IN
( SELECT MIN(ROWID) FROM pronto_wisp GROUP BY wisp_name)
Sameer