如何将值从一个表传递到对象列到另一个表?

问题描述 投票:2回答:1

我有我的主表像这样

create table final(
    Province varchar2(50),
    Country varchar2(100),
    Latitude Number(10,0),
    Longitude Number(10,0),
    Cdate varchar2(20),
    Confirmed int,
    killed int,
    Recover int
) 

然后我用这样的嵌套表创建了Table

create type virus_Statistic_t as object(
vDate varchar2(20),
infection int,
dead int,
recovered int
)
/

create type virus_Statistic_tlb as table of virus_Statistic_t
/

create type countries_t as object(
    Province_or_State varchar2(50),
    Country_or_Region varchar2(100),
    Lat Number(10,0),
    Longt Number(10,0),
    virus virus_Statistic_tlb
)
/

create table countries of countries_t (
       Lat not null,
       Longt not null
) nested table virus store as virus_ntb;

现在我正尝试将所有列值从final传递到countries表。

这是我尝试过的

INSERT INTO countries(Province_or_State, Country_or_Region, Lat, Longt, vDate, infection, dead, recovered)
SELECT  Province, Country, Latitude, Longitude, Cdate, Confirmed, killed, Recover
FROM final
/

出现此错误

ERROR at line 1:
ORA-00904: "RECOVERED": invalid identifier

如何将所有值从最终传递到国家/地区]表?

我有这样的主表,如create table final(Province varchar2(50),Country varchar2(100),Latitude Number(10,0),Longitude Number(10,0),Cdate varchar2(20),Confirmed .. 。

oracle oracle11g sqlplus
1个回答
0
投票

您需要使用类型构造函数。正确的语法是这样的:

© www.soinside.com 2019 - 2024. All rights reserved.