• 网络学院
  • IT资讯
  • 操作系统
  • 网络技术
  • 软件应用
  • 办公软件
  • 编程技术
  • 网站架设
  • 数据库类
  • 平面设计
  • 多媒体类
  • 游戏资讯
  • 教学论文
  • 认证考试
开发技术:关于变量、移动以及含义
  站点:
  • 首 页
  • 最新软件
  • 文章教程
  • 国内软件
  • 国外软件
  • 绿色软件
  • 源码下载
  • 字体下载
开发技术:关于变量、移动以及含义
软件发布 开发技术:关于变量、移动以及含义
网络软件 系统工具 应用软件 联络聊天 图形图像 多媒体类 行业软件 游戏娱乐 编程开发 安全相关 教育教学 数码软件 绿软下载
热门软件: QQ 瑞星 pplive e话通 木马克星 千千静听 office2000 五笔字根 Photoshop 视频分割
返回文章教程首页 >> 文章首页 >> 认证考试 >> Oracle认证 >> Oracle指导 >> 开发技术:关于变量、移动以及含义

开发技术:关于变量、移动以及含义

添加时间: 2008-4-23 22:52:28  作者: Oracle指导  阅读次数:43   来源: http://www.d9soft.com

        Line 8. Because the get_title_or_text procedure is executing two dynamic queries, differing only in the SELECT list, store the rest of those queries (the FROM and WHERE clauses) in a reusable string.

Lines 12-17. Construct the dynamic query to retrieve all titles or text with a matching title.

Line 19. Associate the result set with the cursor variable, for the specified title filter.

Lines 21-23. Compute the number of rows identified by the query.

I can now call this procedure, return a result set, move that data into a collection, and then use the collection in a FORALL statement, as shown in Listing 3.

Code Listing 3: From results to collection to FORALL


1  DECLARE
 2     l_count         PLS_INTEGER;
 3     l_jokes          sys_refcursor;
 4
 5     TYPE jokes_tt IS TABLE OF jokes.text%TYPE;
 6
 7     l_joke_array   jokes_tt      := jokes_tt ();
 8  BEGIN
 9     get_title_or_text (title_like_in         => '%insect%'
10                           ,return_title_in      => FALSE
11                           ,joke_count_out     => l_count
12                           ,jokes_out            => l_jokes
13                           );
14     DBMS_OUTPUT.put_line ('Number of jokes found = ' || l_count);
15
16     FETCH l_jokes
17     BULK COLLECT INTO l_joke_array;
18
19     CLOSE l_jokes;
20
21     FORALL indx IN l_joke_array.FIRST .. l_joke_array.LAST
22        INSERT INTO joke_archive
23             VALUES (SYSDATE, l_joke_array (indx));
24  END;

 

Here is an explanation of the interesting parts of the anonymous block in Listing 3.

Lines 2 and 3. Declare variables to retrieve the values returned by the get_title_or_text procedure.

Lines 5-7. Declare a nested table to hold the data identified by the cursor variable.

Lines 8-13. Call the stored procedure to return the cursor variable and the count of rows in the result set.

Lines 16-19. Use BULK COLLECT to fetch all the rows in the result set into the nested table. Then close the cursor variable. Note that I use BULK COLLECT with an implicit SELECT INTO to retrieve all the rows identified by the cursor. If you are querying a large volume of data, this approach can consume an unacceptable amount of memory. Under such circumstances, you may want to switch to using BULK COLLECT with a LIMIT clause.

Lines 21-23. Use a FORALL statement to push the data into the joke archive.

Listing 4 contains a modified version of the previous anonymous block in Listing 3, showing how to use the LIMIT clause to restrict the number of rows fetched with a BULK COLLECT query, thus reducing the amount of memory needed to populate the collection.

Code Listing 4: From results to collection to FORALL plus LIMIT


DECLARE
   l_count        PLS_INTEGER;
   l_jokes        sys_refcursor;

   TYPE jokes_tt IS TABLE OF jokes.text%TYPE;

   l_joke_array   jokes_tt      := jokes_tt ();
BEGIN
   get_title_or_text (title_like_in             => '%insect%'
                          ,return_title_in          => FALSE
                          ,joke_count_out          => l_count
                          ,jokes_out                 => l_jokes
                          );
   DBMS_OUTPUT.put_line ('Number of jokes found = ' || l_count);

开发技术:关于变量、移动以及含义(2) 第 [1] [2] [3] [4] [5]  下一页

 

上下文章:

 

上一篇文章: 入门基础:连接常见错误及解决方法 下一篇文章: 开发技术:调查您的应用程序需求

相关文章:

  • 教你如何用零框架技术加密网页
  • 用端口碰撞技术实现服务器远程管理
  • 城域网光缆线路设计与技术应用
  • Oracle中关于逻辑备份与恢复
  • Oracle开发人员JAVA存储过程

相关软件:

  • 围棋死活习题集移动版之PocketPC 2003版 1.0
  • 围棋死活习题集移动版之Palm版 1.0
  • 围棋死活习题集移动版之Symbian(S90)版 1.00
  • 围棋死活习题集移动版之PocketPC (ARM)版 1.00
  • 围棋死活习题集移动版之Symbian(s80)版 1.00
  • 围棋死活习题集移动版之PocketPC 2002版 1.00

 

快速导航

  • 网络学院
  • 精品汇聚
  • 字体下载
  • 教程下载
  • ASP源码
  • PHP源码
  • Net源码
  • JSP 源码

Oracle认证分类导航

  • Oracle动态
  • Oracle指导
  • Oracle题库

本类经典文章推荐

  • Oracle中关于逻辑备份与恢复
  • Oracle开发人员JAVA存储过程
  • 为数据库的表自动生成行号
  • Oracle中的OOP概念
  • 用java从oracle取数
  • 冷备份移植到另一台Solaris机器上
  • 如何将excel数据导入oracle中
  • Oracle10.2g安装记录
  • 数据库监控工具ForOraclev1.2
  • oracle双机群集系统

Oracle指导阅读排行

  • Oracle系统表查询
  • 实例:Oracle导出EXCEL文件
  • Oracle常用的OCI函数上
  • Oracle企业管理器(OEM 2.1)使用...
  • Tomcat+SQLServer连接池配置
  • 如何将excel数据导入oracle中
  • 如何取出某一用户的密码 再原样改...
  • 实例:Oracle导出EXCEL文件
  • 案例学习Oracle错误:ORA-00604
  • 案例学习Oracle错误:ORA-00060

Oracle认证阅读总排行

  • Oracle系统表查询
  • 实例:Oracle导出EXCEL文件
  • Oracle常用的OCI函数上
  • 在ORACLE的存储过程中如何做简单的...
  • Oracle企业管理器(OEM 2.1)使用...
  • Tomcat+SQLServer连接池配置
  • 如何将excel数据导入oracle中
  • AIX下自动启动Oracle数据库与监听...
  • 如何取出某一用户的密码 再原样改...
  • 实例:Oracle导出EXCEL文件

广告位置

字母检索 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 回到顶部

关于我们 | 版权声明 | 免责条款 | 广告联系 | 软件发布 | 下载帮助 | 下载排行 | 网站地图 | 特别鸣谢 | 友情连接

copyright; 2005-2008 D9soft.com 第九软件网 版权所有