SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
2 v_Data DBMS_OUTPUT.CHARARR;
3 v_NumLines NUMBER;
4 BEGIN
5 -- Enable the buffer first.
6 DBMS_OUTPUT.ENABLE(1000000);
7
8 DBMS_OUTPUT.PUT_LINE('Line One');
9 DBMS_OUTPUT.PUT_LINE('Line Two');
10 DBMS_OUTPUT.PUT_LINE('Line Three');
11
12 -- Set the maximum number of lines which we want to retrieve.
13 v_NumLines := 3;
14
15 DBMS_OUTPUT.GET_LINES(v_Data, v_NumLines);
16
17 FOR v_Counter IN 1..v_NumLines LOOP
18 DBMS_OUTPUT.put_line(v_Data(v_Counter));
19 END LOOP;
20 END;
21 /
Line One
Line Two
Line Three
PL/SQL procedure successfully completed.
SQL>