Unique Key Syntax
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
ALTER TABLE table_name
ADD CONSTRAINT constraint_name
Oracle Certified Professional
"Build your reputation by helping other people build theirs."
"Sarcasm may be the lowest form of wit but its still funny"
Click HERE to vist my website!
ALTER TABLE EMP ADD CONSTRAINT EMP_NO_UNQ UNIQUE (EMPNO);
It is better to ask and appear ignorant, than to remain silent and remain ignorant.
Oracle OCP DBA 9i,
C++, Java developer
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.
SELECT * FROM pronto_wisp
WHERE ROWID NOT IN
( SELECT MIN(ROWID) FROM pronto_wisp GROUP BY wisp_name)
Last edited by Sameer; 12-16-2002 at 07:22 AM.
Click Here to Expand Forum to Full Width