游标练习(1027)
来源:互联网 发布:越狱软件哪个好 编辑:程序博客网 时间:2024/04/29 20:32
游标(cursor)是系统为用户开设的一个数据缓冲区,存放SQL语句的执行结果
--方法1declaretype sp_class_user_cursor is ref cursor;test_cursor sp_class_user_cursor;u_xingming s_class_user.xingming%type;u_username s_class_user.username%type;beginopen test_cursor for select t.xingming,t.username from s_class_user t where t.class_info_id=&no;loopfetch test_cursor into u_xingming,u_username;exit when test_cursor%notfound;dbms_output.put_line('名字:'||u_xingming||'员工编号:'||u_username);end loop;close test_cursor;end;--方法2declarecursor test_easy_cursor is select t.xingming,t.username from s_class_user t where t.class_info_id=&class_id;u_xingming s_class_user.xingming%type;u_username s_class_user.username%type;beginopen test_easy_cursor;loopfetch test_easy_cursor into u_xingming,u_username;exit when test_easy_cursor%notfound;dbms_output.put_line('名字:'||u_xingming||'员工编号:'||u_username);end loop;close test_easy_cursor;end;
注意:如果控制台只显示PL/SQL procedure successfully completed
没有结果可以尝试输入set serveroutput on size 10000000
来防止ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes
0 0
- 游标练习(1027)
- 游标练习
- oracle 游标练习
- oracle 游标练习
- oracle 游标练习
- Oracle 游标练习
- Oracle 游标的练习
- oracle 游标练习
- 游标存储过程练习4
- 存储过程游标的练习
- 触发器、游标的一些小练习
- mysql 游标和存储过程练习
- oracle游标、临时表使用练习
- Oracle练习:块、过程、函数、游标的练习
- mssql方便的函数使用与游标使用练习
- PLSql -- 练习2 cursor 显式/隐式游标
- 游标
- 游标
- [翻译] AFNetworking 2.0
- centos6 一键配置部署nginx php-fpm redis httpsqs
- zookeeper分布式锁避免羊群效应(Herd Effect)
- 利用jQuery设计横/纵向菜单
- 代理模式之动态代理
- 游标练习(1027)
- Hadoop2.2 WordCount示例
- 【转】RTF格式分析
- WTL安装
- Cocos2d的renderer分析
- 二
- 《c程序设计语言》读书笔记
- java hashmap 原理
- cat ,more ,less 命令的使用和区别