Sample Header Ad - 728x90

ORA-02292: integrity constraint (CITY_COUNTRY_FK) violated - child record found

0 votes
0 answers
48 views
I am trying to make my all table columns in lowercase but the following error appears: SQL> UPDATE COUNTRY SET country_code = LOWER(country_code); UPDATE COUNTRY SET country_code = LOWER(country_code) * ERROR at line 1: ORA-02292: integrity constraint (OWNER.CITY_COUNTRY_FK) violated - child record found Here are my tables: create table country( country_code varchar2(2) PRIMARY KEY, country nvarchar2(57) NOT NULL ); create table city( city_code varchar2(3) PRIMARY KEY, country_code varchar2(3) CONSTRAINT city_country_fk references country(country_code) NOT NULL, city varchar2(24) NOT NULL ); Here is some sample data: INSERT INTO COUNTRY VALUES ('US', 'United States'); INSERT INTO COUNTRY VALUES ('SR', 'Suriname'); INSERT INTO city(city_code,country_code,city) VALUES('BAF','US','Westfield'); INSERT INTO city(city_code,country_code,city) VALUES('BBB','US','Benson'); INSERT INTO city(city_code,country_code,city) VALUES('OEM','SR','Paloemeu'); Thanks
Asked by Raakh (17 rep)
Oct 6, 2024, 07:53 PM
Last activity: Oct 6, 2024, 07:58 PM