調(diào)用Oracle procedure在pl/sql中的操作
以下的文章主要是對pl/sql中創(chuàng)建與調(diào)用Oracle procedure的實際操作步驟,本文主要是通過相關(guān)實際應(yīng)用代碼的實際操作來說明Oracle procedure的實際操作步驟,以下就是正文的主要內(nèi)容的介紹,望你會有所收獲。
- -- Create table
- create table A
- (
- USERID NUMBER(38),
- PWD VARCHAR2(30)
- )
- tablespace USERS
- pctfree 10
- initrans 1
- maxtrans 255
- storage
- (
- initial 64K
- minextents 1
- maxextents unlimited
- );
創(chuàng)建procedure
- create or replace procedure up_sel(cur_test out sys_refcursor)
- is
- begin
- open cur_test for
- select * from a;
- end;
刪除存儲過程
- drop procedure up_sel
提交
- commit
在PL/sql中執(zhí)行procedure
- ---// file-->>new -->>test window
- begin
- -- Call the procedure
- up_sel(cur_test => :cur_test);
- end;
在variable中填入定義的游標(biāo)名 cur_test
在Type中填入游標(biāo)類型 Cursor
點擊Value 右邊的 ...圖標(biāo)即可顯示出所要的結(jié)果
在pl/sql中創(chuàng)建Oracle procedure并調(diào)用中會當(dāng)然也可直接右擊存儲過程后點TEST
刪除數(shù)據(jù)的存儲過程
- create or replace procedure up_del
- (userid in varchar2)
- is
- begin
- delete from a where USERID=userid;
- end;
要在value中填入要傳入的值
增加數(shù)據(jù)
- create or replace procedure up_add
- (
- userid in varchar2,
- pwd in varchar2
- )
- is
- begin
- insert into a(USERID,PWD) values(userid,pwd);
- commit;
- end;
執(zhí)行
- declare
- begin
- up_add(11,'222');
- end;
上述的相關(guān)內(nèi)容就是對在pl/sql中創(chuàng)建Oracle procedure并調(diào)用的描述,希望會給你帶來一些幫助在此方面。
【編輯推薦】