学习 的一个存储过程

create or replace procedure SP_CIF_Test(
  o_Cur   out Types.CursorType,
  o_ret out integer,
  o_msg out varchar2,
    o_TotalAssets out number,--资产合计
    i_CustNo in varchar2--客户号

) is
v_TotalAssets number(16,4);
begin
o_ret :=-99;
o_msg :='未知错误';


select FCOUNTRY  into v_TotalAssets 
   from CIF_PersInfo a
  where a.id = i_CustNo;

  o_TotalAssets:=v_TotalAssets;
  open o_Cur for
select 80 as 房产, 20 as 其他 from  dual;
   DBMS_OUTPUT.PUT_LINE('编码为'||o_msg||'员工工资已更新!');    
  o_ret := 1;
  o_msg := '';
 
  exception
  when others then
        o_ret := -99;
          o_msg := case when o_msg is null then '未知错误' else '在['||o_msg||']处发生异常' end;


end SP_CIF_Test;




  select (
  select nvl(sum(FRealValue),0) from CIF_Pers_FamilyAssets b where b.cif_persinfo_id = a.id
 
  )
         +nvl(a.FPersBankDep,0)/*他行存款*/+nvl(a.FOtherAssets,0) 
   from CIF_PersInfo a
  where a.id = '101332621197308126078';
 

猜你喜欢

转载自huazx1234.iteye.com/blog/2209296