我想执将下面的查询字符串:
declare
strsql varchar2(100);
begin
strsql := select * from hr.demo1;
execute immediate strsql ;
end;
在 sql scratchpad,sql*plus worksheet中只显示命今成功不显示查询结果,是什么原因啊,如果我想显示查询结果怎么操作啊,谢谢!
注: strsql := select * from hr.demo1必需是先赋值,再执行这个STRSQL字符串变量.
在线等,急,问题解决就给分.
你没有打印,当然不显示了!要是想显示,需要调用dbms_output.put_line函数。
还有,你这里没有必要用动态sql。
declare
result hr.demo1%rowtype;
cursor mycursor is
select * from demo1;
begin
open mycursor;
loop
fetch mycursor into result ;
exit when mycursor%notfound;
dbms_output.put_line(result.字段名);
end loop;
end;