Oracle存储过程,带游标
来源:互联网 发布:电视怎么切换网络电视 编辑:程序博客网 时间:2024/05/21 08:00
create or replace procedure aa is bb number;cursor cur is select t.id,v.description from t_user t ,v_userdep v where t.removed=0 and t.login_name = substr(v.login_name,1,12);beginfor c in cur loop bb := 0; select count(*) into bb from t_user_temp s where s.id = c.id; dbms_output.put_line(bb); if(bb<=0) then insert into t_user_temp s (s.id,s.name) values(c.id,c.description); commit; else update t_user_temp s set s.name = s.name || ',' || c.description where s.id=c.id; end if; end loop;end aa;
CREATE OR REPLACE PROCEDURE F_holiday is cursor mycursor is select t.hol_days,t.hol_days_left,t.hol_days_wait,t.hol_id,t.remark from t_hol_holiday t where t.removed=0 ; t_mycursor mycursor%ROWTYPE;begin -- strSql:='select t.hol_days,t.hol_days_left,t.hol_days_wait,t.hol_id,t.remark from t_hol_holiday t where t.removed=0 '; open mycursor; --FETCH v_mysursor INTO holDays,holDaysLeft,holDaysWait,holId,remark; Loop FETCH mycursor INTO t_mycursor; exit when mycursor%NOTFOUND; -- WHILE v_mysursor%FOUND LOOP insert into t_hol_holiday (ID,hol_year,hol_days,hol_days_left,hol_days_wait,removed,operator,operate_time,hol_id,hol_state,remark) values (sys_guid(),'2011',t_mycursor.hol_days,t_mycursor.hol_days,t_mycursor.hol_days,'0','1156',to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),t_mycursor.hol_id,'725',t_mycursor.remark); End LOOP; close mycursor; --关闭游标 EXCEPTION WHEN NO_DATA_FOUND THEN null; WHEN OTHERS THEN -- Consider logging the error and then re-raise RAISE;end F_holiday;
CREATE OR REPLACE PROCEDURE rrrr is cursor mycursor is select t.mc_dx from t_func_xt_ywdxsm t ; t_mycursor mycursor%ROWTYPE;begin -- strSql:='select t.hol_days,t.hol_days_left,t.hol_days_wait,t.hol_id,t.remark from t_hol_holiday t where t.removed=0 '; open mycursor; --FETCH v_mysursor INTO holDays,holDaysLeft,holDaysWait,holId,remark; Loop FETCH mycursor INTO t_mycursor; exit when mycursor%NOTFOUND; -- WHILE v_mysursor%FOUND LOOP insert into t_rectification_user_conf (reserve1,removed) values(t_mycursor.mc_dx,0); End LOOP; close mycursor; --关闭游标 EXCEPTION WHEN NO_DATA_FOUND THEN null; WHEN OTHERS THEN -- Consider logging the error and then re-raise RAISE;end rrrr;
test 窗口 在下方输入 测试数据 执行后即可
command 窗口中 如下执行
set serveroutput onSQL> declare 2 i number; 3 begin 4 pro_test(1,i); 5 dbms_output.put_line(i); 6 end; 7 /
create or replace procedure testt iscursor cur is select * from c_contract c where c.removed = 0 and c.contract_price is not null; n number;begin begin n:=1; dbms_output.put_line (n); for c in cur loop dbms_output.put_line (c.id); n := to_number (c.contract_price); end loop; end;end testt;
- Oracle存储过程,带游标
- Oracle存储过程,带游标
- oracle带游标的存储过程
- 存储过程 带游标
- oracle存储过程,游标
- oracle 存储过程 游标
- oracle存储过程--游标
- oracle 存储过程 游标
- oracle 存储过程 游标
- oracle存储过程游标
- oracle存储过程-游标
- VBA调用带游标返回值的ORACLE存储过程
- oracle 存储过程 带游标作为OUT参数输出
- Oracle存储过程返回带参数游标方法汇总
- oracle中带游标的存储过程示例
- 带游标的存储过程
- 存储过程示例(带游标)
- 带游标的存储过程
- 无光驱情况下,U盘启动安装CentOS nbsp;…
- rhel6.x 利用centos yum源
- 在centos编译gcc4.7[转]
- 给centos 6.2安装yum源
- Linux环境变量配置总结
- Oracle存储过程,带游标
- 手机内支持分享的应用 手机端已安装的apk文件 有什么分别呢
- windows 下 查看端口使用情况
- 【Shell】shell中执行一个字符串定义的语句
- flex连接sql数据库
- Animation与Interpolator及AnimationSet的用法
- 无符号数(unsigned) 和带符号数(int)的循环变量 在for循环条件判断使用中的区别1例
- ibstis中函数用法
- Sybase与WEB语言的连接配置教程