Oracle的dbms_output包的put()和put_line()的区别只是有没有回车换行吗?
答案是否
除了自动添加回车换行外,还有就是缓冲区最大容量的问题!!
无论如何设置serveroutput size,10g里
put() 最多只能输出 32767 个byte
而
put_line() 的最大容量为 1000000个byte
如果你的用户代码足够长(大于32767),就会发现
使用put()会报错,而使用put_line()不会报错!
扫描二维码关注公众号,回复:
1396020 查看本文章
查出结果集并输出:
SET serveroutput ON;
--cursor output
declare
cursor xx is
(
select myuser.sso_id
from myuser, rp_ref_employee rpref
where rpref.soe_id(+) = myuser.sso_id
and rpref.soe_id is null
);
begin
for x in xx loop
dbms_output.put_line(x.sso_id);
end loop;
end;
set serveroutput off;
在oracle developer中,需选中set serveroutput on 与游标一起执行,否则显示
anonymous block completed
,但是并没有打印结果。