Oracle預存程序和函數

來源:互聯網
上載者:User

標籤:oracle 預存程序 函數

  建立一個預存程序:

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;


Oracle預存程序和函數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.