Constraint Unique question [message #23078] |
Sat, 16 November 2002 20:05 |
nat
Messages: 11 Registered: March 2002
|
Junior Member |
|
|
What is the meaning of this error?
21:27:36 ORACLE> CREATE TABLE Lodging1
21:28:11 2 (
21:28:11 3 lodgename VARCHAR2(15) CONSTRAINT lodging_PK PRIMARY KEY,
21:28:11 4 address VARCHAR2(20),
21:28:11 5 name VARCHAR2(25) constraint lodging1-UQ UNIQUE,
21:28:11 6 FOREIGN KEY (name) REFERENCES worker(name)
21:28:11 7 );
name VARCHAR2(25) constraint lodging1-UQ UNIQUE,
*
ERROR at line 5:
ORA-02253: constraint specification not allowed here
But this works:
21:16:50 ORACLE> CREATE TABLE Lodging
21:17:06 2 (
21:17:10 3 lodgename VARCHAR2(15) CONSTRAINT lodging_PK PRIMARY KEY,
21:17:18 4 address VARCHAR2(20),
21:17:22 5 name VARCHAR2(25) UNIQUE,
21:17:25 6 FOREIGN KEY (name) REFERENCES worker(name)
21:17:32 7 );
Table created.
|
|
|
|
|