|
-
Jan 4th, 2008, 11:28 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Oracle SQL Developer Composite Key
This is my first time using Oracle SQL Developer and the statements I'm used to using in MS SQL Server seems to not work on this environment say for example with the use of the following Query:
Code:
/* Code by K0502201*/
CREATE TABLE tblPrice
(
StoreID SMALLINT REFERENCES tblStore(StoreID),
ProdCode CHAR(8) REFERENCES tblProduct(ProdCode),
PricePU NUMERIC(4,2)
CONSTRAINT PriceCK PRIMARY KEY
(StoreID, ProdCode)
);
It gave me the following error:
Code:
Error at Command Line:8 Column:2
Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
Which doesn't make sense at all to me. Both tblStore and tblProduct has already been created 
Any help is greatly appreciated.
-
Jan 4th, 2008, 11:37 AM
#2
Re: Oracle SQL Developer Composite Key
Oracle does not work like SQL Server.
sql Code:
Create Table tblPrice (
StoreID Number NOT NULL,
ProdCode varchar2(8) NOT NULL,
PricePU Number(4,2)
);
Alter Table tblPrice
Add Constraint tblPrice$PK Primary Key
(StoreID,ProdCode);
Alter Table tblPrice
Add Constraint tblPrice#FK1 Foreign Key
(StoreID)
References tblStore;
Alter Table tblPrice
Add Constraint tblPrice#FK2 Foreign Key
(ProdCode)
References tblProdCode;
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Jan 4th, 2008, 11:44 AM
#3
Thread Starter
Hyperactive Member
Re: [RESOLVED] Oracle SQL Developer Composite Key
Thanks,
I never knew that it will take that much code to put it onto Oracle 
Thanks again,
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
|