当前位置:数据库 > Oracle >>

Oracle存储过程测试总结

存储过程创建语法:

•create [or replace] procedure procedure_name
•  [ (argment [ { in| in  out }]  type,
• argment  [ { in | out | in out } ] type
•  { is  | as }
•  <类型.变量的说明>
•  ( 注: 不用 declare 语句 )
•  Begin
•  <执行部分>
• exception
•  <可选的异常处理说明>
•end;
存储过程使用:
Ø在命令窗口
EXEC[UTE]  procedure_name( parameter1, parameter2…);
Ø在sql窗口
begin
  procedure_name( parameter1,  parameter2…);
end;

存储过程调试:

1 包单击右键,单击View Spec & Body菜单


 存储过程中选择一行,在最左边双击,或者点击上方debug-Toggle Breakpoint菜单,增加断点


 存储过程单击右键,单击test菜单

 
 4 在测试窗口中输入存储过程参数值,单击debug-Start菜单,或按快捷键F9


 5 在测试运行窗口中使用debug工具条菜单,单步调试存储过程,在变量中增加监控的变量,调试每一步时会显示变量的值


 函数创建语法:
•create [or replace] function function_name
•  [ (argment [ { in| in  out }]  TYPE,
• argment  [ { in | out | in out } ] type]
•  return return_type  { is  | as }
•  begin
• function_body
•  exception
• . . .  . . .
•  end;
函数使用:
Øfunction_name( parameter1, parameter2…);

例如:
IBIP_IR_DM_PKG.SP_DM_IR_RM_BUS_PROM_PROGRESS中2914行
N_MONTH_KEY :=IBIP_COM_PKG.FN_GET_LAST_MONTH_KEY_SYSDATE;

Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,