游标
来源:互联网 发布:pubmed数据库主题词 编辑:程序博客网 时间:2024/04/27 14:28
--游标
declare
type emp is RECORD(
v_sal employees.salary%type,
v_id employees.employee_id%type,
v_name employees.last_name%type);
v_emp emp;
cursor cursor_emp_sal is select salary,employee_id,last_name from employees where department_id=80;
begin
open cursor_emp_sal;
fetch cursor_emp_sal into v_emp;
while cursor_emp_sal%found loop
dbms_output.put_line(v_emp.v_id||'的'||v_emp.v_sal|| v_emp.v_name);
fetch cursor_emp_sal into v_emp;
end loop;
close cursor_emp_sal;
end;
set serveroutput on;
declare
v_emp employees%rowtype;
cursor cursor_emp_sal is select * from employees where department_id=80;
begin
open cursor_emp_sal;
fetch cursor_emp_sal into v_emp;
while cursor_emp_sal%found loop
dbms_output.put_line(v_emp.employee_id||'的'||v_emp.salary|| v_emp.last_name);
fetch cursor_emp_sal into v_emp;
end loop;
close cursor_emp_sal;
end;
--使用游标的for循环,可以省略打开,提取,关闭游标
declare
cursor cursor_emp_sal is select salary,employee_id,last_name from employees where department_id=80;
begin
for c in cursor_emp_sal loop
dbms_output.put_line('工资'||c.salary||'id'||c.employee_id);
end loop;
end;
--隐式游标
begin
update employees1 set salary=salary+10 where employee_id=100;
if sql%notfound then
dbms_output.put_line('查无此人');
end if;
end;
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- 游标
- JAVA从一个.p12或.pfx文件中获取公钥和私钥
- (一)linux常用,但容易忘记的命令
- jenkins配置用户名和密码
- 浏览器 HTTP 协议缓存机制详解
- 利用python爬虫大量基金股票的净值写入到csv文件中方便做其他计算
- 游标
- python+beautifulsoup/xpath实现新浪微博某博主全部高清大图下载器
- dd
- 2016Y FJNU 2016-2017学年第二十届低年级程序设计竞赛(正式赛) Problem E: 杂物整理
- redis实现购物车
- 【JavaWeb】简述 jsp 页面的工作原理以及请求转发和重定向的区别
- 优秀logo,最基础的设计技巧(四)
- java SWT:用SWTKeySupport方便进行组合键判断(如Ctrl+F11)
- NSOperation的使用