这问题挺有意思,想不出有什么好的方法可以得到存储过程自己的名字。只想到两个间接的方法:
1.在编写存储过程时,增加变量存放存储过程名称。
create or replace procedure proc_myproc(...)
as
...
errcode number;
errmsg varchar2(300);
proc_name varchar2(100) := 'proc_myproc';
begin errmsg:='存储过程'||proc_name||'发生错误,具体错误信息如下:'
errmsg:=errmsg||SQLERRM;
dbms_output.put_line(errmsg);
end;2.将存储过程名称作为存储过程的输入参数传进来,调用方是知道名称的,不过这样会增加输入参数个数,有点累赘。
1.在编写存储过程时,增加变量存放存储过程名称。
create or replace procedure proc_myproc(...)
as
...
errcode number;
errmsg varchar2(300);
proc_name varchar2(100) := 'proc_myproc';
begin errmsg:='存储过程'||proc_name||'发生错误,具体错误信息如下:'
errmsg:=errmsg||SQLERRM;
dbms_output.put_line(errmsg);
end;2.将存储过程名称作为存储过程的输入参数传进来,调用方是知道名称的,不过这样会增加输入参数个数,有点累赘。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货