Home » SQL & PL/SQL » SQL & PL/SQL » Unique constraints
Unique constraints [message #251420] Fri, 13 July 2007 09:21 Go to next message
swapnajojo
Messages: 40
Registered: June 2007
Location: India
Member


Is it possible to deine unique key on two columns in a table


For eg:

SQL> ED
Wrote file afiedt.buf

1 create table inter_un00(checkno number(2) constraint un_con1 unique,NEWCOL VARCHAR2(40) CONSTRAINT UN_CONS00
2* UNIQUE ,NAME VARCHAR2(78))
SQL> /


SQL> ED
Wrote file afiedt.buf
Table created.


Is this correct .

I have read in oracle Documention the following


"Restrictions on Unique Constraints
A table or view can have only one unique key."
Re: Unique constraints [message #251425 is a reply to message #251420] Fri, 13 July 2007 09:35 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
A table can have only one PRIMARY KEY but many UNIQUE keys.

What is the documentation where you found this?

Regards
Michel
Re: Unique constraints [message #251426 is a reply to message #251420] Fri, 13 July 2007 09:38 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What is your Oracle database version (i.e. the one you used to run the script) and which Oracle version covers your documentation (i.e. the book that contains that statement)?
Re: Unique constraints [message #251434 is a reply to message #251426] Fri, 13 July 2007 10:17 Go to previous messageGo to next message
swapnajojo
Messages: 40
Registered: June 2007
Location: India
Member
Oracle9i SQL Reference, Release 2 (9.2) - DOCUMENTATION VERSION

I Have run the script in Personal Oracle9i Release 9.2.0.1.0 - Production
Re: Unique constraints [message #251439 is a reply to message #251434] Fri, 13 July 2007 11:04 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
More precisely, chapter, section, page... all that allow us to go to the sentence.
For instance go to http://tahiti.oracle.com find the book, the sentence and post the link.

Regards
Michel
Re: Unique constraints [message #251449 is a reply to message #251420] Fri, 13 July 2007 11:26 Go to previous messageGo to next message
joy_division
Messages: 4643
Registered: February 2005
Location: East Coast USA
Senior Member
swapnajojo wrote on Fri, 13 July 2007 10:21



"Restrictions on Unique Constraints
A table or view can have only one unique key."




I remember seeing this some time ago in the past. It is definitely a mistake in the documentation (but I do remember seeing it in the official Oracle documentation). I would hope they have fixed it in the 10g documentation.
Re: Unique constraints [message #251465 is a reply to message #251449] Fri, 13 July 2007 13:03 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Right; here it is (official 9iR2 documentation, SQL Reference book).
Re: Unique constraints [message #251467 is a reply to message #251465] Fri, 13 July 2007 13:11 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Hopefully this no more exists in 10g(R2).

Regards
Michel
Re: Unique constraints [message #251469 is a reply to message #251467] Fri, 13 July 2007 13:21 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
No, it doesn't.
Previous Topic: Attributes
Next Topic: As the current one hangs when run
Goto Forum:
  


Current Time: Thu Dec 08 16:41:44 CST 2016

Total time taken to generate the page: 0.13525 seconds