游标的使用
来源:互联网 发布:java html 转换为xml 编辑:程序博客网 时间:2024/05/11 02:24
--创建包,并且定义类型test_cursor为游标
create or replace package testpackage
as type test_cursor is ref cursor;
end testpackage;
--创建过程,获取数据
create or replace procedure afei_pro_emp(
spNo in number,
spcursor out testpackage.test_cursor) is
begin
open spcursor for
select * from emp where deptno = spNo;
end afei_pro_emp;
select * from emp;
declare
--定义一个游标
type afei_cur_test1 is ref cursor;
--定义一个游标变量
test_cur afei_cur_test1;
--定义变量
v_name emp.empname%type;
v_sal emp.wage%type;
begin
--执行部分
--把test_cur和一个select结合起来
open test_cur for select empname, wage from emp where postcode = &no;
--循环取出
loop
fetch test_cur into v_name, v_sal;
--判断是否test_cur为空
exit when test_cur % notfound;
dbms_output.put_line('姓名:' || v_name || ' 工资:' || v_sal);
end loop;
end;
0 0
- 关于游标的使用
- 游标的使用
- 游标的使用
- 游标的使用
- 游标的使用
- 游标的使用
- 游标的使用
- 游标的使用问题
- 游标的使用
- sqlserver游标的使用
- sql游标的使用
- 使用游标的触发器
- sql2000-游标的使用
- SQL游标的使用
- [MSSQL]游标的使用
- 游标的使用
- mysql 游标的使用
- mysql 游标的使用
- memcached_server_push
- 栈的应用 - 简单计算器
- 游标的使用demo
- 安装Dreamweaver CS5.5显示Exit Code:7
- lua 函数回调技巧
- 游标的使用
- python lambda的使用
- android网络判断
- windows下关于telnet功能的回显问题的解决办法
- 三维引擎设计-图形窗口封装
- 我所认识的GNU make(6) -- 如何生成Makefile文件
- JBOSS EAP 6 系列五 Managed domains 管理域最主要的功能是“统一部署,统一配置”
- SzNOI c003 中缀表达式转后缀表达式
- Amr and Pins——圆的旋转