oracle存储过程,自定义类型,plsql客户端test

原创
2021/01/22 20:53
阅读数 556

1、oracle存储过程

create or replace procedure pf_demo_proc(in_type_receive_commissions_array    in type_receive_commissions_array,
                                                     returnvalue out varchar2 --返回结果 1 成功 0 失败
                                                     ) as
  p_name    varchar2(1000);
  p_sqlerrm varchar2(1000);
  p_error   varchar2(1000);
  v_guid    varchar2(32) := md5(sys_guid());
begin
  FOR i IN 1 .. in_type_receive_commissions_array.count LOOP
    returnvalue:=returnvalue||'{id:'||in_type_receive_commissions_array(i).contract_no||', name:'||in_type_receive_commissions_array(i).receive_amount||'},';
  END LOOP;
end pf_demo_proc;

2、plsql客户端存储过程test测试

declare
  -- Non-scalar parameters require additional processing 
  --in_type_receive_commissions_arr type_receive_commissions_array;
  v_type1 type_receive_commissions := type_receive_commissions('01','02','03','04','05','06');
  v_type2 type_receive_commissions := type_receive_commissions('11','12','13','14','15','16');
  v_type3 type_receive_commissions := type_receive_commissions('21','22','23','24','25','26');
  in_type_receive_commissions_array type_receive_commissions_array := type_receive_commissions_array(v_type1, v_type2, v_type3);
begin
  -- Call the procedure
  pf_demo_proc(in_type_receive_commissions_array => in_type_receive_commissions_array,
               returnvalue => :returnvalue);
end;

test结果

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部