【问题标题】:Add a column to a nested table向嵌套表中添加列
【发布时间】:2019-01-31 10:55:31
【问题描述】:

我有这张桌子

parlamentari
---------------
id|nome|cognome

我可以在此表中添加一个名为 telefoni 的嵌套列吗? 我试过了

create table or replace type telefoni_nt as table of varchar2(10) after dnn;

alter table parlamentari add telefoni telefoni_nt  nested table telefoni store telefoni_tab;

没有成功。 谢谢

【问题讨论】:

    标签: oracle oracle11g nested-table


    【解决方案1】:

    我想你想要:

    create table parlamentari( id integer, nome varchar2(20), cognome varchar2(20));
    
    create or replace type telefoni_nt as table of varchar2(10);
    
    alter table parlamentari 
            add (telefoni telefoni_nt)
    nested table telefoni store as telefoni_tab;
    

    并且在“create table or replace type telefoni_nt”中有一个错字table

    SQL Fiddle Demo

    【讨论】:

    • 对不起,我有一个小问题。为什么当我一起执行所有这些指令时,列没有被创建,而当我一一执行这些指令时,列被创建了?有什么区别?
    • Ciao @keiichi,您可以通过发出命令来创建列,如小提琴中所示。
    猜你喜欢
    • 2017-02-25
    • 1970-01-01
    • 2020-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-24
    相关资源
    最近更新 更多