Fork me on GitHub

oracle-pl/sql之三

集合与记录

 

set serveroutput on
create or replace package my_types authid definer is
 type my_rec is record (a number,b number);
 function init_my_rec return my_rec;
end my_types;
/

create or replace package body my_types is
  function init_my_rec return my_rec is 
    rec my_rec;
  begin
    rec.a :=6;
    rec.b :=8;
    return rec;
  end init_my_rec;
end my_types;
/

declare
  r constant my_types.my_rec :=my_types.init_my_rec();
begin
  dbms_output.put_line('r.a= '||r.a);
  dbms_output.put_line('r.b= '||r.b);
end;
/

 

posted on 2017-08-01 16:43  阳光-源泉  阅读(167)  评论(0编辑  收藏  举报

导航