SQL Oracle ORA-00902 无效数据类型错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24978942/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 02:18:47  来源:igfitidea点击:

Oracle ORA-00902 Invalid datatype error

sqloracle

提问by Siddharth

I am trying to create two tables, which is throwing ORA-00902 error, can't figure out what's wrong here...

我正在尝试创建两个表,这是抛出 ORA-00902 错误,无法弄清楚这里出了什么问题......

CREATE TABLE VEHICLE_STORE
( 
  MODEL_NO VARCHAR2(12) NOT NULL,
  DESCRIPTION VARCHAR2(1000) NOT NULL,
  UNIT_PRICE NUMBER(10) NOT NULL,
  CURRENT_STOCK NUMBER(5) NOT NULL,
  CC NUMBER(3) NOT NULL,    
  CONSTRAINT vehicle_store_pk PRIMARY KEY(MODEL_NO)
);

CREATE TABLE VEHICLE_BOOKING
( 
  BOOKING_ID VARCHAR2(12) NOT NULL,
  CUSTOMER_NAME VARCHAR2(30) NOT NULL,
  EMAIL_ID VARCHAR2(30) NOT NULL,
  CONTACT NUMBER(15) NOT NULL,
  ADDRESS VARCHAR2(500) NOT NULL,
  PINCODE NUMBER(10) NOT NULL,
  MODEL_NO VARCHAR2(12) NOT NULL,
  DATE_OF_BOOKING VARCHAR2(12) NOT NULL,
  EXPECTED_DATE_OF_DELIVERY VARCHAR2(12) NOT NULL,  
  CONSTRAINT vehicle_booking_pk PRIMARY KEY(BOOKING_ID),
  CONSTRAINT vehicle_booking_fk FOREIGN_KEY(MODEL_NO) REFERENCES    VEHICLE_STORE(MODEL_NO)   
);

Thanks in advance...

提前致谢...

回答by a_horse_with_no_name

Change FOREIGN_KEY(MODEL_NO)to FOREIGN KEY (MODEL_NO)(no underscore).

更改FOREIGN_KEY(MODEL_NO)FOREIGN KEY (MODEL_NO)(无下划线)。