惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
V
V2EX
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Register - Security
The Register - Security
MongoDB | Blog
MongoDB | Blog
P
Privacy International News Feed
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
美团技术团队
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
K
Kaspersky official blog
S
Secure Thoughts
T
Tenable Blog
Security Latest
Security Latest
The Cloudflare Blog
S
Security @ Cisco Blogs
H
Heimdal Security Blog
aimingoo的专栏
aimingoo的专栏
TaoSecurity Blog
TaoSecurity Blog
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
IT之家
IT之家
Latest news
Latest news
The Hacker News
The Hacker News
C
Check Point Blog
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
N
News | PayPal Newsroom
Forbes - Security
Forbes - Security
P
Palo Alto Networks Blog
S
Security Affairs
S
Securelist
Google Online Security Blog
Google Online Security Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
A
About on SuperTechFans

博客园 - Good life

香港地铁线路图 经典语录 最新中国象棋运动员技术等级标准及业余棋手晋级办法 关于 mcafee 8.7 更新失败的 解决办法 如何让任务栏右下角里的Windows安全警报不显示 ORA-01036: 非法的变量名/编号 - Good life 去掉创建方式时生成的小箭头及"快捷方式到" - Good life - 博客园 关于“.aspx调用CodeFile(.cs文件)中变量 ”总结 - Good life windows2003 远程桌面“终端服务器超出了最大允许连接数”的解决方案 generic host process for win services 之解决办法 安装程序不能验证 Update.inf 文件的完整性 之解决办法 XP远程桌面mstsc和带参数的mstsc /console的差别 office简繁体转换插件 serv-u 9.3.0.1 注册机 彻底清除微软拼音输入法 oracle 导入导出实用程序(imp/exp) oracle 导入/出命令 escape, encodeURI, encodeURIComponent wonderful life
游标遍历
Good life · 2010-03-02 · via 博客园 - Good life

游标遍历

-- 将user_tables的所有table_name以逗号间隔作为一个字符串输出 -- 通过for循环 显示游标 遍历 declare var_sql varchar2(32767) := ''; cursor cur is select table_name from user_tables order by table_name; begin for rec in cur loop var_sql := var_sql || rec.table_name || ','; end loop; var_sql := substr(var_sql, 1, length(var_sql) - 1); dbms_output.put_line(var_sql); end; -- 通过for循环 隐式游标 遍历 declare var_sql varchar2(32767) := ''; begin for rec in (select table_name from user_tables order by table_name) loop var_sql := var_sql || rec.table_name || ','; end loop; var_sql := substr(var_sql, 1, length(var_sql) - 1); dbms_output.put_line(var_sql); end; -- 通过loop..if遍历 declare cursor cur is select table_name from user_tables order by table_name; var_sql varchar2(32767) := ''; var_table_name user_tables.table_name%type; begin open cur; loop fetch cur into var_table_name; if cur%notfound then var_sql := substr(var_sql, 1, length(var_sql) - 1); exit; else var_sql := var_sql || var_table_name || ','; end if; end loop; close cur; dbms_output.put_line(var_sql); end; -- 通过loop..exit when遍历 declare cursor cur is select table_name from user_tables order by table_name; var_sql varchar2(32767) := ''; var_table_name user_tables.table_name%type; begin open cur; loop fetch cur into rec; exit when cur%notfound; var_sql := var_sql || var_table_name || ','; end loop; close cur; var_sql := substr(var_sql, 1, length(var_sql) - 1); dbms_output.put_line(var_sql); end; -- 通过loop..record类型遍历 declare cursor cur is select table_name from user_tables order by table_name; type type_rec is record( table_name user_tables.table_name%type); rec type_rec; var_sql varchar2(32767) := ''; begin open cur; loop fetch cur into rec; exit when cur%notfound; var_sql := var_sql || rec.table_name || ','; end loop; close cur; var_sql := substr(var_sql, 1, length(var_sql) - 1); dbms_output.put_line(var_sql); end;

posted on 2010-03-02 14:25  Good life  阅读(387)  评论()    收藏  举报