Oracle存儲(chǔ)過程的創(chuàng)建
本人是Oracle 的熱捧者,以下的相關(guān)內(nèi)容主要是我個(gè)人對(duì)于Oracle存儲(chǔ)過程的一個(gè)總結(jié),其中包括儲(chǔ)存過程的創(chuàng)建,以及變量賦值的實(shí)際應(yīng)用,以下就是文章的具體內(nèi)容的描述,希望你會(huì)有所收獲。
1、創(chuàng)建存儲(chǔ)過程
- create or replace procedure test
(var_name_1 in type,var_name_2 out type) as
聲明變量(變量名 變量類型)
- begin
Oracle存儲(chǔ)過程的執(zhí)行體
- end test;
打印出輸入的時(shí)間信息
- E.g:
- create or replace procedure test(workDate in Date) is
- begin
- dbms_output.putline('The input date is:'
||to_date(workDate,'yyyy-mm-dd'));- end test;
2、變量賦值
變量名 := 值;
- E.g:
- create or replace procedure test(workDate in Date) is
- x number(4,2);
- begin
- x := 1;
- end test;
3、判斷語句
if 比較式 then begin end; end if;
- E.g
- create or replace procedure test(x in number) is
- begin
- if x >0 then
- begin
- x := 0 - x;
- end;
- end if;
- if x = 0 then
- begin
- x: = 1;
- end;
- end if;
- end test;
上述的相關(guān)內(nèi)容就是對(duì)Oracle存儲(chǔ)過程總結(jié)的描述,希望會(huì)給你帶來一些幫助在此方面。
【編輯推薦】
- 用觸發(fā)器實(shí)現(xiàn)Oracle操作日志
- Oracle數(shù)據(jù)庫(kù)中經(jīng)常使用的啟動(dòng)方式介紹
- Oracle數(shù)據(jù)庫(kù)中3種常用的關(guān)閉方式
- Oracle11g認(rèn)證考試的3個(gè)主要途徑
- Oracle SQL的優(yōu)化的規(guī)則描述