当前位置:
首页 >
游标复习笔记
发布时间:2025/3/11
26
豆豆
--while循环访问游标declarecursor cur_dept isselect * from dept;v_dept cur_dept%rowtype;beginopen cur_dept;fetch cur_dept into v_dept;while cur_dept%found loopdbms_output.put_line(v_dept.dname);fetch cur_dept into v_dept;end loop;close cur_dept;end;
--returning返回某一值declarev_sal emp.sal%type;beginselect sal into v_sal from emp where ename='SMITH';dbms_output.put_line(v_sal);update emp set sal=sal+100 where ename='SMITH' returning sal into v_sal;if v_sal >850 thendbms_output.put_line(v_sal);rollback;end if;end;
--returning返回某一值declarev_sal emp.sal%type;beginselect sal into v_sal from emp where ename='SMITH';dbms_output.put_line(v_sal);update emp set sal=sal+100 where ename='SMITH' returning sal into v_sal;if v_sal >850 thendbms_output.put_line(v_sal);rollback;end if;end;
总结
- 上一篇: Python联网下载文件
- 下一篇: SysinternalsSuite工具