我不斷收到如下所示的我的代碼「缺少關鍵字」當Oracle SQL Developer中創建一個表
"SQL Error: ORA - 00905: missing keyword" in the "CREATE TABLE"
部分:
CREATE TABLE Orders (
Received CHAR(9),
Shipped CHAR(9),
FOREIGN KEY (Ono), REFERENCES Odetails (Ono),
FOREIGN KEY (Cno), REFERENCES customers (Cno),
FOREIGN KEY (Eno), REFERENCES employee (Eno),
PRIMARY KEY (Ono, Cno, Eno)
);
CREATE TABLE ZIPCODES (
ZIP CHAR(5) NOT NULL,
City CHAR(20),
FOREIGN KEY (ZIP), REFERENCES customers (ZIP),
PRIMARY KEY (ZIP)
);
但是,我在同一個工作表中寫了這個代碼和沒有得到任何錯誤是如此如此:
CREATE TABLE Odetails (
Ono CHAR(4) NOT NULL,
Pno CHAR(5) NOT NULL,
Qty CHAR(1),
FOREIGN KEY (Pno), REFERENCES parts (Pno),
PRIMARY KEY (Ono)
);
任何人都可以幫助我確定是什麼導致錯誤?
謝謝!有效! – kagehana
@ kagehana不客氣。勾選答案http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235 :) – lad2025
此外,最好使用'VARCHAR2'而不是'CHAR',填充空白空間達到所定義的大小,並且是存儲的浪費。 –