1. create or replace procedure users_procedure is
  2. cursor users_cursor is select * from users;
  3. v_id users.id%type;
  4. v_username users.username%type;
  5. v_password users.password%type;
  6. begin
  7. open users_cursor;
  8. fetch users_cursor into v_id, v_username, v_password;
  9. while users_cursor%found
  10. loop
  11. dbms_output.put_line('v_id = ' || v_id || 'v_username = ' || v_username || 'v_password = ' || v_password);
  12. fetch users_cursor into v_id, v_username, v_password;
  13. end loop;
  14. close users_cursor;
  15. end;
  16. /
  17.  
  18. create or replace procedure users_batch_insert_procedure is
  19. v_id users.id%type;
  20. v_username users.username%type;
  21. v_password users.password%type;
  22. begin
  23. for i in 0..1000
  24. loop
  25. v_id := i;
  26. v_username := 'abc' || i;
  27. v_password := 'efg' || i;
  28. insert into users values(v_id, v_username, v_password);
  29. commit;
  30. end loop;
  31. end;
  32. /
  33.  
  34. create or replace procedure users_a is
  35. type users_cursor_type is ref cursor; --return users%rowtype;
  36. type users_record_type is record (v_id users.id%type, v_username users.username%type, v_password users.password%type);
  37. v_sql varchar2(2000);
  38. users_cursor_a users_cursor_type;
  39. users_record users_record_type;
  40. begin
  41. v_sql := 'select * from users';
  42. open users_cursor_a for v_sql;
  43. fetch users_cursor_a into users_record;
  44. while users_cursor_a%found
  45. loop
  46. dbms_output.put_line('v_id = ' || users_record.v_id || 'v_username = ' || users_record.v_username || 'v_password = ' || users_record.v_password);
  47. fetch users_cursor_a into users_record;
  48. end loop;
  49. close users_cursor_a;
  50. end;
  51. /
  52.  
  53. create or replace procedure users_a is
  54. type users_cursor_type is ref cursor return users%rowtype;
  55. v_row users%rowtype;
  56. v_sql varchar2(2000);
  57. users_cursor_a users_cursor_type;
  58. begin
  59.  
  60. open users_cursor_a for select * from users;
  61. fetch users_cursor_a into v_row;
  62. while users_cursor_a%found
  63. loop
  64. dbms_output.put_line('v_id = ' || v_row.id || 'v_username = ' || v_row.username || 'v_password = ' || v_row.password);
  65. fetch users_cursor_a into v_row;
  66. end loop;
  67. close users_cursor_a;
  68. end;
  69. /
  70.  
  71. set serveroutput on size 1000000;

Oracle 存储过程A的更多相关文章

  1. oracle 存储过程

    来自:http://www.jb51.net/article/31805.htm Oracle存储过程基本语法 存储过程 1 CREATE OR REPLACE PROCEDURE 存储过程名 2 I ...

  2. Oracle存储过程语法

    原文链接:http://www.jb51.net/article/31805.htm Oracle存储过程基本语法 存储过程  1 CREATE OR REPLACE PROCEDURE 存储过程名  ...

  3. ORACLE存储过程调用Web Service

    1. 概述 最近在ESB项目中,客户在各个系统之间的服务调用大多都是在oracle存储过程中进行的,本文就oracle存储过程调用web service来进行说明.其他主流数据库,比如mysql和sq ...

  4. Oracle存储过程基本语法介绍

    Oracle存储过程基本语法 存储过程 1 CREATE OR REPLACE PROCEDURE 存储过程名 2 IS 3 BEGIN 4 NULL; 5 END; 行1: CREATE OR RE ...

  5. MyBatis调用Oracle存储过程

    MyBatis调用Oracle存储过程 1.无输入和输出参数的存储过程 2.带有输入和输出参数的存储过程 3.返回游标的存储过程 mybatis中的配置文件代码 <resultMap type= ...

  6. Oracle存储过程(转)

    Oracle存储过程基本语法 存储过程 1 CREATE OR REPLACE PROCEDURE 存储过程名 2 IS 3 BEGIN 4 NULL; 5 END; 行1: CREATE OR RE ...

  7. Oracle存储过程中异常Exception的捕捉和处理

    Oracle存储过程中异常的捕捉和处理 CREATE OR REPLACE Procedure Proc_error_process ( v_IN in Varchar2, v_OUT Out Var ...

  8. Oracle存储过程动态创建临时表/存储过程执行权限问题--AUTHID CURRENT_USER

    关于Oracle存储过程执行权限问题的解决 http://blog.sina.com.cn/s/blog_6ceed3280101hvlo.html (2014-04-02 04:06:28) 转载▼ ...

  9. ORACLE存储过程学习

    存储过程 1 CREATE OR REPLACE PROCEDURE 存储过程名 2 IS 3 BEGIN 4 NULL; 5 END; 行1: CREATE OR REPLACE PROCEDURE ...

  10. C# 获取 oracle 存储过程的 返回值1

    /// <summary> /// 返回对应表的模拟自增字段值 /// </summary> /// <param name="tablename"& ...

随机推荐

  1. c#中sealed修饰符

    sealed 修饰符表示密封 用法: 1.用于类时,表示该类不能再被继承,不能和abstract同时使用,因为这两个修饰符在含义上互相排斥 2.用于方法和属性时,表示该方法或属性不能再被重写,必须和o ...

  2. js判断是移动端还是PC端访问网站

    window.location.href = /Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent) ? "htt ...

  3. c#设计模式之装饰器模式(Decorator Pattern)

    引子 在面向对象语言中,我们常常会听到这样一句话:组合优于继承.那么该如何去理解这句话呢? 下面我将以游戏装备为模型用简单的代码去展示它 先创建一个装备的抽象类,然后创建刀枪2个具体的业务子类 pub ...

  4. qi zi

    #include<stdio.h> ]; ][]; int N; typedef struct node{ int x; }node; node dui[]; int se(int a) ...

  5. 洛谷P3964 [TJOI2013]松鼠聚会(坐标系变换)

    题面 传送门 题解 对于两个点\((x_i,y_i)\)和\(x_j,y_j\),我们定义它们之间的曼哈顿距离为 \[|x_i-x_j|+|y_i-y_j|\] 定义它们的切比雪夫距离为 \[\max ...

  6. 基于.NET的开源搜索引擎-DotLucene(2)

    NLucene是将 Lucene 从 Java 移植到 .NET 的一个 SourceForge 项目,它从 Lucene 1.2 版本转化而来. Lucene.Net因为 NLucene 项目到20 ...

  7. scrapy入门例子

    使用爬取http://quotes.toscrape.com/内容,网站内容很简单 一. 使用scrapy创建项目 scrapy startproject myscrapy1 scrapy gensp ...

  8. 终于搞定在VS2010中将CString转换为const char*

    最近碰到了CString 转 const char *的问题. 以前只要简单的一个强制转换就OK了,可现在是不行了,搜索了很多资料,终于搞定,主要是Unicode和ANSI的问题,只要做一个转换就可以 ...

  9. 总结day1 ---- 基础内容学习 ,以及历史了解

    知识目录 一 : python 的发展历史 1. pyhton2 和pyhton3 的区别 二: python的语言分类 三 :变量 四: 常量 五 :注释 六 : 基本数据类型 1 : int 2 ...

  10. 回归到jquery

    最近在做一个公司的老产品的新功能,使用原来的技术框架,jquery和一堆插件,使用jquery的话,灵活性是有了,但是对于一个工作了3年多的我来说,很low,没什么成就感,技术本身比较简单,但是业务的 ...