Knowee
Questions
Features
Study Tools

constraint fk_contact_no foreign key(contact_no) references branch(contact_no)                                       *                                          ERROR at line 6:                                                                ORA-02267: column type incompatible with referenced column type

Question

constraint fk_contact_no foreign key(contact_no) references branch(contact_no)                                       *                                          ERROR at line 6:                                                                ORA-02267: column type incompatible with referenced column type

🧐 Not the exact question you are looking for?Go ask a question

Solution

The error message you're seeing, "ORA-02267: column type incompatible with referenced column type," is from Oracle Database. It means that the data type of the 'contact_no' column in your table doesn't match the data type of the 'contact_no' column in the 'branch' table.

Here's how you can fix this issue:

  1. Check the data type of the 'contact_no' column in both tables. You can do this by running the following SQL command:
SELECT data_type 
FROM user_tab_columns 
WHERE table_name = 'YOUR_TABLE_NAME' 
AND column_name = 'CONTACT_NO';

Replace 'YOUR_TABLE_NAME' with the name of your table.

  1. Once you've identified the data types, alter the 'contact_no' column in your table to match the data type of the 'contact_no' column in the 'branch' table. Here's an example of how you can do this:
ALTER TABLE your_table_name 
MODIFY (contact_no NEW_DATA_TYPE);

Replace 'your_table_name' with the name of your table, and 'NEW_DATA_TYPE' with the correct data type.

  1. After you've modified the data type, try creating the foreign key constraint again. If the data types match, you should be able to create the constraint without any issues.

This problem has been solved

Similar Questions

Referential Integrity Constraint: Foreign Key

Error starting at line : 6 File @ /oracle.sqlIn command -create table CROP(CROP_ID NUMBER primary key,CROP_NAME VARCHAR2(100) NOT NULL,PLANTING_DATE DATE NOT NULL,FIELD_ID NUMBER NOT NULL,constraint FK_FIELD_ID foreign key (FIELD_ID)references FIELD(FIELD_ID),constraint FK_FIELD_CONDITION_FIELD_ID foreign key (FIELD_ID) references FIELD(FIELD_ID))Error report -ORA-02274: duplicate referential constraint specifications02274. 00000 - "duplicate referential constraint specifications"*Cause: Self-evident.*Action: Remove the duplicate specification.

Remove the foreign key constraint named fk_driver from the VEHICLES table.

______ is NOT a type of constraint in SQL language?FOREIGN KEYPRIMARY KEYUNIQUEALTERNATE KEY

Error starting at line : 7 File @ /oracle.sqlIn command -create table FIELD_CONDITION(CONDITION_ID NUMBER,FIELD_ID NUMBER NOT NULL,CONDITION_TYPE VARCHAR2(50) NOT NULL,VALUE NUMBER NOT NULL,RECORDED_AT TIMESTAMP NOT NULL,constraint FK_FIELD_CONDITION_FIELD_ID foreign key (FIELD_ID) references FIELD(FIELD_ID),constraint CK_CONDITION_TYPE check(CONDITION_TYPE in('soil moisture','temperature','humidity','pH'))Error report -ORA-00907: missing right parenthesis00907. 00000 - "missing right parenthesis"*Cause:

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.