温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Oracle存储过程和函数

发布时间:2020-07-17 21:01:35 来源:网络 阅读:238 作者:haodiandian 栏目:关系型数据库

  创建一个存储过程:

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; 
   --跳转标志符,名称自己指定 
<<log>> 
        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;


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI