|
-
Lots of examples in Oracle Doc on creating a multicolumn primary key constraint, just check the master index.
Here is an example:
SQL> create table test1 (col1 number, col2 number);
Table created.
SQL> alter table test1 ADD (CONSTRAINT test1_pk PRIMARY KEY (col1,col2));
Table altered.
SQL> select table_name, constraint_type from user_constraints where constraint_name = 'TEST1_PK';
TABLE_NAME C
------------------------------ -
TEST1 P
SQL> select * from user_cons_columns where constraint_name = 'TEST1_PK';
OWNER CONSTRAINT_NAME TABLE_NAME COLUMN_NAME POSITION
---------- ------------------ ---------- ------------ ----------
SCOTT TEST1_PK TEST1 COL1 1
SCOTT TEST1_PK TEST1 COL2 2
SQL>
JR
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
|