1

我有以下代码:

DECLARE
 TYPE rt_someDetails IS RECORD(
    deny_discount           VARCHAR2(4) DEFAULT 'NO');
 TYPE someDetails_va IS VARRAY(2) OF rt_someDetails;

 l_someDetails_va someDetails_va;
 l_rt_someDetails rt_someDetails;
BEGIN
 l_someDetails_va := someDetails_va();
 l_someDetails_va.EXTEND;

 -- when in varray, the default value doesn't show up
 dbms_output.put_line('From array:: ' || l_someDetails_va(1).deny_discount);

 -- However, when outside of varray, it works properly
 dbms_output.put_line('Directly from record var:: ' || l_rt_someDetails.deny_discount);
END;

为什么deny_discount从 varray 中的记录读取时没有显示默认值?

4

1 回答 1

1

扩展不会按说填充数组,它只是为将来的插入分配空间(想想 NULL 元素)

尝试创建一条记录并插入到数组中。简单地扩展不会显示任何内容。

于 2013-10-17T13:29:11.530 回答