-
Unique Key Syntax
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.
SHIVANAND HANUMANTAPPA
-
This should help
Code:
ALTER TABLE table_name
ADD CONSTRAINT constraint_name
UNIQUE (column_name)
Regards
Jim
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!
-
Hi,
use:
ALTER TABLE
ADD CONSTRAINT
UNIQUE ();
example:
ALTER TABLE EMP ADD CONSTRAINT EMP_NO_UNQ UNIQUE (EMPNO);
Cheers,
R.
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
SHIVANAND HANUMANTAPPA
-
You are trying to create UNIQUE constraint on column WISP_NAME, but it has duplicate contents.
Code:
SELECT * FROM pronto_wisp
WHERE ROWID NOT IN
( SELECT MIN(ROWID) FROM pronto_wisp GROUP BY wisp_name)
Above sql stmt will give you duplicate records for WISP_NAME. You need to delete duplicate entries prior to creating constraint.
Sameer
Last edited by Sameer; 12-16-2002 at 08:22 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|