2014-01-09 166 views
0

你能告诉我为什么这不起作用吗?我想在嵌套表A,B添加一个值,C使用索引的先行嵌套表格是记录和嵌套表格

PL/SQL

TYPE chars is table of varchar2(30); 
TYPE numbers is table of number; 
TYPE t_content IS RECORD(a numbers, b chars, c chars); 
TYPE t_table IS table of t_content index by varchar2(30); 
v_information t_table; 

内。然后在宣告

v_information ('Index1').a:= numbers(); 

我无法访问里面的表a,b,c使用索引值表。哪里不对?

+0

什么是错误您收到?剩下的代码是什么? – Rachcha

回答

0

首先声明一个记录变量。

尝试:

DECLARE 
    TYPE chars is table of varchar2(30) ; 
    TYPE numbers is table of number ; 
    TYPE t_content IS RECORD(a numbers, b chars, c chars) ; 
    TYPE t_table IS table of t_content index by varchar2(30) ; 
    v_information t_table; 
    my_record t_content; 
BEGIN 
    my_record.a := numbers(1,2,3,4); 
    my_record.b := chars('a','b','c'); 
    my_record.c := chars('x','y','z'); 
    v_information('Index1') := my_record; 

    my_record.a := numbers(22,44); 
    my_record.b := chars('aa','bb','cc'); 
    my_record.c := chars('x','y'); 
    v_information('Index2') := my_record; 
END; 
/

演示: