表结构如下:
create table VIEW_SETTING
(
  MODULEID    VARCHAR2(5) not null,
  MODULENAME  VARCHAR2(20) not null,
  TABLENAME   VARCHAR2(20),
  SEARCHFIELD VARCHAR2(50),
  FIELD_LIST  FIELD_NT,//表类型,嵌套表字段
  TYPE        NUMBER(1) default 0 not null,
  GOTO        VARCHAR2(100)
)
nested table FIELD_LIST store as FIELD_NT_TAB-----------------------------------------------------------------------------------------
第一种情况:
我用pl/sql工具表编辑器往该表中添加一条数据
MODULEID  MODULENAME TABLENAME              SEARCHFIELD   TYPE   GOTO
'2315'    '综合查询'  'v_constract_three'   '9999'        '1' '  a.jsp'
再使用sql语句
insert into table(select field_list from view_setting where moduleid=2315 and type=1) values('2','1');向该条记录的嵌套表中插入一条数据,却报ora-22908:null表值的参考
------------------------------------------------------------------------------------
第二种情况:
我先使用
insert into view_setting values('2315','综合查询','V_CONSTRACT_THREE','9999',field_nt(field_ty('1','1')),'1','')
向该表和它的嵌套表中插入数据,,
再使用
insert into table(select field_list from view_setting where moduleid=2315 and type=1) values('2','1');
这时就正常------------------------------------------------------------------------------------
我想问一个大家有没有碰到过这种情况,为何会这样呢.是不是嵌套表必须要被初始化一下才能向它里
边插入数据吗????

解决方案 »

  1.   

    insert into table 中table是另外一个表吗
      

  2.   

    oracle版是怎么回事啊,怎么这么冷清啊,各位大哥帮帮忙啊
      

  3.   

    先不要用PL/SQL,直接用SQL也插入null的试一下可能吗?
      

  4.   

    ORA-22908 reference to NULL table valueCause: The evaluation of the THE subquery or nested table column resulted in
    a NULL value implying a NULL table instance. The THE subquery or nested
    table column must identify a single non-NULL table instance.Action: Ensure that the evaluation of the THE subquery or nested table column
    results in a single non-null table instance. If happening in the context of an
    INSERT statement where the THE subquery is the target of an insert, then
    ensure that an empty nested table instance is created by updating the nested
    table column of the parent table's row specifying an empty nested table
    constructor.我想问一个大家有没有碰到过这种情况,为何会这样呢.是不是嵌套表必须要被初始化一下才能向它里
    边插入数据吗????
    ====================================
    参照上面写的,必须要初始化,才能向它里边插入数据吗
      

  5.   

    http://www.daima.com.cn/Info/72/Info27090/
    我试了上面的例子是成功的,所以我觉得可以不先初始化。但是我不知道在pl/sql中是怎么向collection字段中添加数据的,只知道用sql往表里插入。