详解Oracle游标的简易用法
发表于:2025-02-06 作者:千家信息网编辑
千家信息网最后更新 2025年02月06日,下面看下Oracle游标的简易用法,具体代码如下所示:create or replace procedure NW_DelYW(iOPERATION_ID number,
千家信息网最后更新 2025年02月06日详解Oracle游标的简易用法
下面看下Oracle游标的简易用法,具体代码如下所示:
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 游标循环添加删除更新。
知识点扩展:
Oracle游标简单示例
使用游标打印员工姓名和薪水
set serveroutput on;declarecursor 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;/
带参数的游标
使用游标打印某部门号的所有员工姓名
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;/
总结
以上所述是小编给大家介绍的详解Oracle游标的简易用法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
游标
简易
员工
姓名
薪水
帮助
代码
出处
参数
日志
疑问
知识
知识点
示例
网站
门号
循环
支持
更新
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
系统软件开发者
监控druid数据库状态
电大网络安全技术考题
oag航班时刻航线数据库
网络安全法安全行为
某某区网络安全事件应急预案
服务器固定ip可以备案吗
网络技术和软件开发竞赛
综合软件开发私人定做
数据库都有那种
多个软件一个数据库出现问题
原生软件开发费用
金华比齐网络技术有限公司
cpu单核天梯图包含服务器
成都办公系统软件开发哪家专业
redis物理服务器要求
西宁网络技术选择
一级计算机网络技术
如何禁用数据库宏
中国 网络安全战略
2012服务器无管理员权限
三列成绩数据库
接触网软件开发课题
在线diy相册软件开发
中国农业进出口数据库
有前景的网络安全接入控制
创远网络技术有限公司
军团要塞2是哪个服务器
魔兽pve pvp服务器差别
清除安全下载数据库