SET SERVEROUTPUT OFF/ON : SERVEROUTPUT « SQL Plus « Oracle PL / SQL

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » SQL Plus » SERVEROUTPUT 
SET SERVEROUTPUT OFF/ON
  
SQL>
SQL>
SQL> SET ECHO ON
SQL> SET SERVEROUTPUT OFF
SQL>
SQL> BEGIN
  2    DBMS_OUTPUT.ENABLE (2000);
  3    DBMS_OUTPUT.PUT_LINE('Three names will be written.');
  4    DBMS_OUTPUT.PUT('J');
  5    DBMS_OUTPUT.NEW_LINE;
  6    DBMS_OUTPUT.PUT('S');
  7    DBMS_OUTPUT.NEW_LINE;
  8    DBMS_OUTPUT.PUT('T');
  9    DBMS_OUTPUT.NEW_LINE;
 10  END;
 11  /

PL/SQL procedure successfully completed.

SQL>
SQL> SET SERVEROUTPUT ON
SQL> DECLARE
  2    throw_away VARCHAR2(50);
  3    names DBMS_OUTPUT.CHARARR;
  4    lines_to_get NUMBER;
  5    inx1 NUMBER;
  6    combined_names VARCHAR2(80);
  7    status NUMBER;
  8  BEGIN
  9    DBMS_OUTPUT.GET_LINE(throw_away, status);
 10
 11    lines_to_get := 3;
 12    DBMS_OUTPUT.GET_LINES(names, lines_to_get);
 13
 14    combined_names := '';
 15    FOR inx1 IN .. lines_to_get LOOP
 16      IF inx1 > THEN
 17        combined_names := combined_names || ' and ';
 18      END IF;
 19
 20      combined_names := combined_names || names(inx1);
 21    END LOOP;
 22    DBMS_OUTPUT.PUT_LINE(combined_names);
 23  END;
 24  /
J and S and T

PL/SQL procedure successfully completed.

SQL>
SQL> --

   
  
Related examples in the same category
1.WORD_WRAPPED option for FORMAT wraps each line to the length specified by the value of the LINESIZE variable
2.TRUNCATED formatting option: each line of the displayed output is truncated exactly at the length specified by the LINESIZE variable.
3.The SET SERVEROUTPUT Command
4.SET SERVEROUTPUT ON SIZE 1000000
5.Make sure SQL*Plus SERVEROUTPUT setting is on
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.