error in inserting to foreign key column from mastert table
Date: November 20, 2010 01:20AM
i have createdd two tables having foreign key relationship the tables are
CREATE TABLE fee_class_category (
class_category_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
class_from SMALLINT UNSIGNED NULL,
class_to SMALLINT UNSIGNED NULL,
PRIMARY KEY(class_category_id)
)
TYPE=InnoDB;
CREATE TABLE fee_class_category_name (
class_category_name VARCHAR(15) NOT NULL,
class_category_id INTEGER UNSIGNED NOT NULL,
class_category_name_id SMALLINT UNSIGNED NULL,
PRIMARY KEY(class_category_name),
FOREIGN KEY(class_category_id)
REFERENCES fee_class_category(class_category_id)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
TYPE=InnoDB;
when i am trying to insert values from class_category_id column from fee_class_category into class_category_id column of fee_class_category_name table. it is showing below error
Error Code : 1062
Duplicate entry '' for key 1
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.