Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle ORA-00902 Invalid datatype error

Tags:

sql

oracle

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

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...

like image 277
Siddharth Avatar asked Mar 18 '23 22:03

Siddharth


1 Answers

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

like image 183
a_horse_with_no_name Avatar answered Mar 21 '23 12:03

a_horse_with_no_name