This is my coding in SQL:
CREATE TABLE TICKET (
TICKET_NO NUMBER,
VENUE_NO VARCHAR(3),
TICKET_DATE DATE,
TICKET_PRICE NUMBER(8,2),
PRIMARY KEY (TICKET_NO),
CONSTRAINT TICKET_VENUE_NO_FK
FOREIGN KEY (VENUE_NO) REFERENCES VENUE
);
This is error stated:
Error starting at line 1 in command:
CREATE TABLE TICKET (
TICKET_NO NUMBER,
VENUE_NO VARCHAR(3),
TICKET_DATE DATE,
TICKET_PRICE NUMBER(8,2),
PRIMARY KEY (TICKET_NO),
CONSTRAINT TICKET_VENUE_NO_FK
FOREIGN KEY (VENUE_NO) REFERENCES VENUE)
Error at Command Line:8 Column:13
Error report:
SQL Error: ORA-02267: column type incompatible with referenced column type
02267. 00000 - "column type incompatible with referenced column type"
*Cause: The datatype of the referencing column is incompatible with the
What wrong with my coding?
Check that the VENUE_NO field in the VENUE table is of the same type as in this table, i.e. VARCHAR(3).
You need to make sure that the data types match between the TICKET.VENUE_NO
column and the VENUE.VENUE_NO
column.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With