DBMS_OUTPUT.GET_LINES : dbms_output « System Packages « Oracle PL / SQL






DBMS_OUTPUT.GET_LINES

   
SQL>
SQL> CREATE TABLE MyTable (
  2    num_col    NUMBER,
  3    char_col   VARCHAR2(60)
  4    );

Table created.

SQL>
SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
  2    v_Data      DBMS_OUTPUT.CHARARR;
  3    v_NumLines  NUMBER;
  4  BEGIN
  5    DBMS_OUTPUT.ENABLE(1000000);
  6
  7    DBMS_OUTPUT.PUT_LINE('Line One');
  8    DBMS_OUTPUT.PUT_LINE('Line Two');
  9    DBMS_OUTPUT.PUT_LINE('Line Three');
 10
 11    v_NumLines := 3;
 12
 13    DBMS_OUTPUT.GET_LINES(v_Data, v_NumLines);
 14
 15    FOR v_Counter IN 1..v_NumLines LOOP
 16      INSERT INTO MyTable (char_col)
 17        VALUES (v_Data(v_Counter));
 18    END LOOP;
 19  END;
 20  /

PL/SQL procedure successfully completed.

SQL>
SQL> select * from MyTable;

   NUM_COL CHAR_COL
---------- ------------------------------------------------------------
           Line One
           Line Two
           Line Three

SQL>
SQL> drop table MyTable;

Table dropped.

SQL>
SQL>

   
    
  








Related examples in the same category

1.Displaying Hello World! to the Screen
2.Call dbms_output.disable
3.Call dbms_output.put_line to display text message
4.dbms_output.enable
5.EXECUTE DBMS_OUTPUT.ENABLE(10000)
6.dbms_output.put: display text without new line sign
7.Call dbms_output.new_line to create a new line
8.Combine text and number in DBMS_OUTPUT.PUT_LINE
9.A small buffer
10.dbms_output.new_line
11.DBMS_OUTPUT.NEW_LINE: a new line sign
12.Use DBMS_OUTPUT.PUT_LINE to output clob data
13.Use DBMS_OUTPUT.PUT_LINE to output the table collection indexed by BINARY_INTEGER
14.This script demonstrates the DBMS_OUTPUT package
15.Output Visual line break