日期:2014-05-17  浏览次数:20873 次

打印表名的存储过程,不知道错在哪里?
存储过程:
SQL code
create or replace procedure query_tables as
cursor c_row_rec
is
select table_name from user_tables where table_name like 'LEE_CLIENT%';
begin
 for v_row_rec in c_row_rec loop 
 dbms_output.put_line(v_row_rec.table_name);
  end loop;
end;



执行 exce query_tables后 提示:
cann't perform this operation on a close dataset

请教达人!

------解决方案--------------------
exce query_tables?
写错了
------解决方案--------------------
我用你的存储过程在我本机试了一下没有任何错误
begin
-- Call the procedure
query_tables;
end;
------解决方案--------------------
写的应该没有错误。

可以执行。

引用楼主 zhuche110 的帖子:
存储过程:

SQL codecreate or replace procedure query_tables as
cursor c_row_rec
is
select table_name from user_tables where table_name like 'LEE_CLIENT%';
begin
for v_row_rec in c_row_rec loop
dbms_output.put_line(v_row_rec.table_name);
end loop;
end;




执行 exce query_tables后 提示:
cann't perform this operation on a close dataset

请教达人!

------解决方案--------------------
在数据库端写的right,执行没有错误。
你的报错信息不像oracle的报错,应该是应用调用query_tables时报的错吧,可能是应用调用的代码写的有问题。

探讨
写的应该没有错误。

可以执行。

引用楼主 zhuche110 的帖子:
存储过程:

SQL codecreate or replace procedure query_tables as
cursor c_row_rec
is
select table_name from user_tables where table_name like 'LEE_CLIENT%';
begin
for v_row_rec in c_row_rec loop
dbms_output.put_line(v_row_rec.table_name);
end loop;
end;


执行 exce query_tables后 提示:
cann't perform thi…

------解决方案--------------------
toad的DBMS OUTPUT 
ENABLED了吗?
默认是disabled的啊,你要按下红灯,变成绿灯才行啊
------解决方案--------------------
toad的DBMS OUTPUT 需要亮绿灯才能看到输出。我在自己的数据库上执行了一下,是可以的,但可以匹配上的表太多的话,需要等1、2秒才能看到输出结果。
------解决方案--------------------
set serveroutput on与你的存储过程无关