Oracle存储过程和函数

2015-11-21 01:28:29 · 作者: · 浏览: 2
创建一个存储过程:
?
CREATE OR REPLACE procedure proc_trade( 
  v_tradeid in tt_b.number%TYPE,                        --交易id 
  v_third_ip in tt_b.varchar2%TYPE,                     --第三方ip 
  v_third_time in tt_b.date%TYPE ,                      --第三方完成时间 
   v_thire_state in tt_b.number%TYPE ,                  --第三方状态 
  o_result out tt_b.number%TYPE,                        --返回值 
  o_detail out tt_b.varchar2%TYPE                       --详细描述 
) 
as
   --变量赋值 
   o_result:=0; 
   o_detail:='验证失败'; 
  
   --业务逻辑处理 
    if v_tradeid >
100 then insert into table_name(...) values(...); commit; elsif v_tradeid < 100 and v_tradeid>50 then insert into table_name(...) values(...); commit; else goto log; end if; --跳转标志符,名称自己指定 <> o_result:=1; --捕获异常 exception when no_data_found then result := 2; when dup_val_on_index then result := 3; when others then result := -1; end proc_trade;

?