📄 08-dbug1.sql
字号:
REM 08-DBUG1.SQL
REM This file contains the version of package Debug used to solve
REM the first problem in 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.
CREATE OR REPLACE PACKAGE Debug AS
/* First version of the debug package. This package works
by inserting into the debug_table table. In order to see
the output, select from debug_table in SQL*Plus with:
SELECT debug_str FROM debug_table ORDER BY linecount; */
/* This is the main debug procedure. p_Description will be
concatenated with p_Value, and inserted into debug_table. */
PROCEDURE Debug(p_Description IN VARCHAR2, p_Value IN VARCHAR2);
/* Resets the Debug environment. Reset is called when the
package is instantiated for the first time, and should be
called to delete the contents of debug_table for a new
session. */
PROCEDURE Reset;
END Debug;
/
CREATE OR REPLACE PACKAGE BODY Debug AS
/* v_LineCount is used to order the rows in debug_table. */
v_LineCount NUMBER;
PROCEDURE Debug(p_Description IN VARCHAR2, p_Value IN VARCHAR2) IS
BEGIN
INSERT INTO debug_table (linecount, debug_str)
VALUES (v_LineCount, p_Description || ': ' || p_Value);
COMMIT;
v_LineCount := v_LineCount + 1;
END Debug;
PROCEDURE Reset IS
BEGIN
v_LineCount := 1;
DELETE FROM debug_table;
END Reset;
BEGIN /* Package initialization code */
Reset;
END Debug;
/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -