日期:2014-05-16  浏览次数:20414 次

oracle数组使用笔记
CREATE OR REPLACE Type dev_test Is Object(
c_Rcpt_No     Nvarchar2(50),  --收据号
c_clm_no      Nvarchar2(100)
)

--使用1
declare
  testObj dev_test;
begin

  testObj := dev_test('888', '9999');
  dbms_output.put_line(testObj.c_Rcpt_No);

exception
  when others then
    dbms_output.put_line(sqlcode || sqlerrm);
end;


--使用2
declare
  Type tt Is Table Of dev_test;
  testObj tt;
begin

  testObj := tt();
  testObj.Extend(1);
  testObj(1) := new dev_test('12', '43');

  dbms_output.put_line(testObj(1).c_Rcpt_No);
exception
  when others then
    dbms_output.put_line(sqlcode || sqlerrm);
end;