存储过程中出现未找到任何数据

坠落尘埃 2016-02-02 05:49:16
在执行存储过程中发现了ORA-01403: 未找到任何数据,但是把那段sql打印出来放到命令行运行是有数据的。且该用户具有dba权限,同时也授权了grant select any dictionary to xxx;代码如下:
create or replace procedure test
AUTHID CURRENT_USER as
v_error_col varchar2(1000);
begin
select g.column_name
into v_error_col
from (select r.owner, r.TABLE_NAME, t.COLUMN_NAME
from dba_tables r, dba_tab_columns t
where r.TABLE_NAME = t.TABLE_NAME) g,
dba_col_comments l
where g.table_name = l.table_name
and g.owner=l.owner
and g.column_name = l.column_name
and l.comments =参数
and g.owner =参数
and g.table_name = upper(参数)
group by g.column_name;
dbms_output.put_line(v_error_col);
end;
这个到底是什么原因造成的。
...全文
767 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jdsnhan 2016-02-04
  • 打赏
  • 举报
回复
1、你确信把语句复制出来,代入条件,有数据展示出来? 2、一般情况下,为了防止报错,用exception when no_data_found then捕获这个异常 3、从你给的语句上看,返回一个值,过程中没有聚合函数的出现,那group by又是干啥用的呢
ORAClE SE 2016-02-03
  • 打赏
  • 举报
回复
一个个条件实验就定位哪个条件的问题

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧