08-outpt.sql

来自「《Oracle8i PL/SQL程序设计》附源码」· SQL 代码 · 共 40 行

SQL
40
字号
REM 08-OUTPT.SQL
REM This file contains the example demonstrating the DBMS_OUTPUT
REM package, from Chapter 8 of "Oracle PL/SQL Programming".

REM This is version 1.0 of this file, updated 2/18/96.
REM Comments and questions should go to Scott Urman, at
REM surman@us.oracle.com.

SET SERVEROUTPUT ON
DECLARE
  /* Demonstrates using PUT_LINE and GET_LINE. */
  v_Data      DBMS_OUTPUT.CHARARR;
  v_NumLines  NUMBER;
BEGIN
  -- Enable the buffer first.
  DBMS_OUTPUT.ENABLE(1000000);

  -- Put some data in the buffer first, so GET_LINES will
  -- retrieve something.
  DBMS_OUTPUT.PUT_LINE('Line One');
  DBMS_OUTPUT.PUT_LINE('Line Two');
  DBMS_OUTPUT.PUT_LINE('Line Three');

  -- Set the maximum number of lines which we want to retrieve.
  v_NumLines := 3;

  /* Get the contents of the buffer back. Note that v_Data is
     declared of type DBMS_OUTPUT.CHARARR, so that it matches
     the declaration of DBMS_OUTPUT.GET_LINES. */
  DBMS_OUTPUT.GET_LINES(v_Data, v_NumLines);

  /* Loop through the returned buffer, and insert the contents
     into temp_table. */
  FOR v_Counter IN 1..v_NumLines LOOP
    INSERT INTO temp_table (char_col)
      VALUES (v_Data(v_Counter));
  END LOOP;
END;
/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?