使用PL/SQL创建,测试Oracle存储过程
2015-01-29 20:27
260 查看
首先在左边的文件夹中选中procedures文件夹,新建一个存储过程,如下:
点击左上角的运行按钮,执行这个存储过程
会在下方看见编译成功的提示
然后在这个存储过程的名字上方右键->Test
在下方如图所示输入存储过程中定义的参数的值
点击上方这个按钮开始调试这个存储过程
先不要点击运行按钮,否则看不到效果,点击左数第二个(单步执行)
当运行到你的输出语句时,把鼠标放在变量上面会看见此时变量的值,如下图:
测试完毕
create or replace procedure uc_users_amount_pro(endDate in varchar2) is insMember number; perMember number; insMemberMon number; perMemberMon number; -- 变量名 表名.字段名%type; -- rowtype表示该类型为行数据类型,存储的是一行数据,一行数据里可以有多列,类似于表里的一行数据,也可以是游标里的一行数据,如: -- vs_row1 表%rowtype; -- vs_row2 游标%rowtype; -- CURSOR 游标名 [( 参数 in type)] IS -- Select 语句 begin select count(*) into insMember from uc_users u, uc_form f where u.form_id = f.id and f.form_cn = '企业会员' and u.gmt_create < to_timestamp(endDate,'yyyy-mm-dd'); select count(*) into perMember from uc_users u, uc_form f where u.form_id = f.id and f.form_cn = '个人会员' and u.gmt_create < to_timestamp(endDate,'yyyy-mm-dd'); select count(*) into insMemberMon from uc_users u, uc_form f where u.form_id = f.id and f.form_cn = '企业会员' and to_char(u.gmt_create, 'yyyy-mm') = to_char(to_timestamp(endDate, 'yyyy-mm-dd'), 'yyyy-mm'); select count(*) into perMemberMon from uc_users u, uc_form f where u.form_id = f.id and f.form_cn = '个人会员' and to_char(u.gmt_create, 'yyyy-mm') = to_char(to_timestamp(endDate, 'yyyy-mm-dd'), 'yyyy-mm'); dbms_output.put_line(insMember || ' ' || perMember || ' ' || insMemberMon || '' || perMemberMon); end uc_users_amount_pro;
点击左上角的运行按钮,执行这个存储过程
会在下方看见编译成功的提示
然后在这个存储过程的名字上方右键->Test
在下方如图所示输入存储过程中定义的参数的值
点击上方这个按钮开始调试这个存储过程
先不要点击运行按钮,否则看不到效果,点击左数第二个(单步执行)
当运行到你的输出语句时,把鼠标放在变量上面会看见此时变量的值,如下图:
测试完毕
相关文章推荐
- Oracle存储过程,使用PL/SQL工具测试
- 使用SQL*Plus创建ORACLE存储过程报编译错误,如何知道具体错误信息?
- [PL/SQL]测试存储过程执行超长SQL(使用CLOB变量)
- Oracle sql 调优:使用虚拟索引在生产环境测试创建索引对数据库性能的影响
- 源码-Oracle数据库管理-第十二章-使用PL/SQL创建Oracle程序-Part 1(PL/SQL基础)
- <一>Oracle11g的安装+数据库创建+PL/SQL Dev的使用初步
- PL/SQL Developeri学习使用之创建用户
- oracle 使用pl/sql创建用户和表空间
- PL/SQL之包的创建和使用处理
- 使用PL/SQL Developer 创建定时JOB实例
- 源码-Oracle数据库管理-第十二章-使用PL/SQL创建Oracle程序-Part 2(PL/SQL语言概览)
- 在PL/SQL中使用命令创建和删除表空间
- nullnull使用PL/SQL获取创建用户的语句
- Oracle存储过程单步调试方法(使用pl/sql developer工具)
- 使用pl/sql来Oracle创建表空间和创建用户
- [PL/SQL]测试存储过程执行超长SQL(使用CLOB变量)
- 使用pl/sql创建yu删除表空间
- oracle使用PL/SQL创建用户
- 使用PL/SQL Developer工具来实现创建表空间、创建数据库、备份数据库、数据导出等操作
- pl/sql创建并使用存储过程