游标复习笔记
--while循環(huán)訪問游標(biāo)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;
總結(jié)
- 上一篇: Python联网下载文件
- 下一篇: SysinternalsSuite工具