Я создал финальную таблицу,
create table final(
Province varchar2(50),
Country varchar2(50),
Latitude Number,
Longitude Number,
C_Date varchar2(20),
Confirmed int,
Deaths int,
Recovered int
)
Я создал вложенную таблицу и типы, подобные следующим:
create type virus_Static_t as object(
c_date varchar2(20),
confirm_count int,
death_count int,
recovered_count int
)
create type virus_Static_tlb as table of virus_Static_t
create type countries_t as object(
Province_or_State varchar2(50),
Country_or_Region varchar2(100),
Lat Number,
Longt Number,
virus virus_Static_tlb
)
create table countries of countries_t (
Province_or_State null,
Country_or_Region not null,
Lat not null,
Longt not null,
primary key(Province_or_State, Country_or_Region)
) nested table virus store as virus_ntb
затем я попытался вставить данные из моей финальной таблицы, используя этот запрос
INSERT INTO countries(Province_or_State,Country_or_Region,Lat,Longt,virus)
SELECT Province,Country,Latitude,Longitude,
CAST(MULTISET(SELECT virus_Static_t(C_Date, Confirmed, Deaths, Recovered)
FROM final f2
WHERE f2.Province=f1.Province
AND f2.Country=f1.Country
AND f2.Latitude=f1.Latitude
AND f2.Longitude=f1.Longitude
) AS virus_Static_tlb
)
FROM final f1
GROUP BY Province,Country,Latitude,Longitude;
, затем я получил ошибку, подобную этой
ОШИБКА в строке 2: ORA-01400: cannot insert NULL into ("DSDA"."COUNTRIES"."PROVINCE_OR_STATE")