下面看下Oracle游標(biāo)的簡(jiǎn)易用法,具體代碼如下所示:
成都創(chuàng)新互聯(lián)專注于企業(yè)成都營(yíng)銷網(wǎng)站建設(shè)、網(wǎng)站重做改版、臨縣網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5網(wǎng)站設(shè)計(jì)、商城網(wǎng)站制作、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為臨縣等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。
create or replace procedure NW_DelYW(iOPERATION_ID number, sUserID varchar2) is sCurDJBH yw_operation_link.djbh%type; cursor table_yw(ywid yw_operation.id%type) is select * from yw_operation_link t1 where t1.operation_id = ywid; begin for dr in table_yw(iOPERATION_ID) loop sCurDJBH := dr.djbh; --取得opercationid /* select t1.operation_id into sOperationID from yw_operation_link t1 where t1.djbh = sCurDJBH;*/ --寫日志 insert into log_zfywinfo (DJBH, DJDL, DJXL, DLMC, XLMC, SLR, SLRID, SQRXM, FWZL, ZFRQ, ZFRID, zfr) select distinct sCurDJBH, t4.id, t3.id, t4.name, t3.name, t1.slry, t1.slryid, t1.SQRXM, t1.zl, sysdate, sUserID, (select tt.name from pw_user tt where tt.id=sUserID) from yw_operation t1 join yw_operation_link t2 on t2.operation_id = t1.ID join BUSINESS_TYPE t3 on t3.id = t1.business_id join BUSINESS_CLASS t4 on t4.id = t3.parent_id where t1.ID = dr.operation_id; exception when others then rollback; dbms_output.put_line(sqlerrm); end NW_DelYW;
Oracle使用cursor 游標(biāo)循環(huán)添加刪除更新。
知識(shí)點(diǎn)擴(kuò)展:
Oracle游標(biāo)簡(jiǎn)單示例
使用游標(biāo)打印員工姓名和薪水
set serveroutput on; declare cursor cemp is select ename,sal from emp; cname emp.ename%type; csal emp.sal%type; begin open cemp; loop fetch cemp into cname,csal; exit when cemp%notfound; dbms_output.put_line(cname || '的薪水是' || csal); end loop; end; /
帶參數(shù)的游標(biāo)
使用游標(biāo)打印某部門號(hào)的所有員工姓名
set serveroutput on; declare cursor cemp(cno emp.deptno%type) is select ename from emp where emp.deptno = cno; cname emp.ename%type; begin open cemp(10); loop fetch cemp into cname; exit when cemp%notfound; dbms_output.put_line(cname); end loop; end; /
總結(jié)
以上所述是小編給大家介紹的詳解Oracle游標(biāo)的簡(jiǎn)易用法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)創(chuàng)新互聯(lián)網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
本文標(biāo)題:詳解Oracle游標(biāo)的簡(jiǎn)易用法
當(dāng)前URL:http://aaarwkj.com/article28/peiojp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、定制網(wǎng)站、靜態(tài)網(wǎng)站、網(wǎng)站導(dǎo)航、網(wǎng)站內(nèi)鏈、服務(wù)器托管
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
網(wǎng)頁(yè)設(shè)計(jì)公司知識(shí)