以前曾使用过Oracle dbms_output,继续熟悉;
执行如下一句,报告错误,

必须放到begin...end里面;

上图也没有把文字输出,因为默认没有开启控制台显示;如下图就输出了文字,

put,是把内容放入buffer,没有输出,不会显示,

如下图,put之后再使用new_line,会输出buffer的内容并回车换行,

在oracle数据文件中最小的单位就是block, 用户读取block数据时,oracle就会将block的数据放入缓存,那么缓存中对应block的单位就叫buffer了, block的大小与buffer大小是一样的;
buffer的默认值是20000bytes,可设置的最小值为2000bytes,最大值为1000000bytes;默认大小如下图,

使用for循环输出数字,oracle的写法是for in loop...end loop;

或者写成如下图;

sql
set serveroutput on;
begin
dbms_output.put_line('输出并换行');
end;
begin
dbms_output.put('输出并换行,AAAA');
dbms_output.new_line;
end;
begin
for i in 1..9
loop
dbms_output.put_line(i);
end loop;
end;
begin
for i in 1..9 loop
dbms_output.put_line(i*i);
end loop;
end;