psj01 psj01 - 6 months ago 13
SQL Question

Why does my dbms_output.put('AAA'); line not printing anything...?

DECLARE
i number(1);
j number(1);
BEGIN
<< outer_loop >>
FOR i IN 1..2 LOOP
<< inner_loop >>
FOR j IN 1..i LOOP
dbms_output.put('AAA');
END loop inner_loop;
END loop outer_loop;
END;
/


I have the code above .. but its not printing 'AAA' ..
it works fine if i do dbms_output.put_line('AAA');

but i want to be able to print it on one line..

Why isn't dbms_output.put('AAA'); not working?..

Answer

Even if you want to print in one line, you´ll need a final dbms_out.put_line which will "flush" the output. If you don´t, you won´t see anything ...

Comments