设为首页 加入收藏

TOP

PLSQL带参数的游标的定义与应用
2015-11-21 01:51:12 来源: 作者: 【 】 浏览:0
Tags:PLSQL 参数 标的 定义 应用
CURSOR cursor_name(parameter_name datatype) IS select_statement; --只能制定类型,不能指定具体大小
OPEN cursor_name(参数值);
FECTH cursor_name INTO variable,...;
CLOSE cursor_name;


declare cursor emp_cursor(v_depnto number) is select ename,sal from scott.emp where deptno = v_depnto order by empno;
emp_record emp_cursor%rowtype; v_dno number;
begin v_dno := &no;
if not emp_cursor%isopen then open emp_cursor(v_dno);
end if; null;
loop fetch emp_cursor into emp_record;
exit when emp_cursor%notfound; dbms_output.put_line('姓名:'||emp_record.ename||',工资:'||emp_record.sal);
end loop; null;
if emp_cursor%isopen then close emp_cursor;
end if; end;

?


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇(一)SQLite与SQL语句基础 下一篇linux的一些常用操作(随时更新)..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: