百科生活 投稿
关于【如何执行存储过程】:如何执行存储过程,今天涌涌小编给您分享一下,如果对您有所帮助别忘了关注本站哦。
- 内容导航:
- 1、如何执行存储过程
- 2、Oracle存储过程调用过程中,如何获取当前正在执行的过程的信息?
1、如何执行存储过程
存储过程要怎样执行,本文用plsql工具演示怎样执行存储过程
打开plsql,输入登录名和密码进行登录。
登录成功后,进入命令窗口。
在窗口里输入存储过程,例子所示
输入setserveroutputon;按回车键
用execute存储过程名(参数)。
执行存储过程。
或者也可以用
begin
存储过程名(参数)。
end。
在其他代码中,比如java里也可以调用存储过程
2、Oracle存储过程调用过程中,如何获取当前正在执行的过程的信息?
概述
我们在调用存储过程的时候,发生异常,经常无法判断是那个存储过程发生了错误,而导致问题不好排查,Oracle提供了一个在运行过程中获取存储过程名字的过程:OWA_UTIL.WHO_CALLED_ME.下面一起来看看怎么用吧~
一、OWA_UTIL.WHO_CALLED_ME Procedure
This procedure returns information (in the form of output parameters) about the PL/SQL code unit that invoked it.
这个过程返回有关调用它的PL/SQL代码单元的信息(以输出参数的形式)
1、语法:
2、参数解释:
二、实验
1、创建存储过程
create or replace procedure child_proc(id number) as owner_name VARCHAR2(100); caller_name VARCHAR2(100); line_number NUMBER; caller_type VARCHAR2(100);begin OWA_UTIL.WHO_CALLED_ME(owner_name, caller_name, line_number, caller_type); DBMS_OUTPUT.put_line('【id:】 ' || id || ' 【caller_type:】 ' || caller_type || ' 【owner_name:】 ' || owner_name || ' 【caller_name:】 ' || caller_name || ' 【line_number:】 ' || line_number);end;/create or replace procedure parent_proc as v_child_proc VARCHAR2(100) := 'begin child_proc (1); end;';begin execute immediate v_child_proc; child_proc(2);end;/
2、测试
本文关键词:命令执行存储过程,怎么执行存储过程,如何执行存储过程监控,如何执行存储过程控制,如何执行存储过程sql。这就是关于《如何执行存储过程,存储过程怎么调用存储过程(如何获取当前正在执行的过程的信息)》的所有内容,希望对您能有所帮助!
- 最近发表