Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu Oracle Database 11g PL/SQL Programming P2 ppt
MIỄN PHÍ
Số trang
10
Kích thước
283.7 KB
Định dạng
PDF
Lượt xem
786

Tài liệu Oracle Database 11g PL/SQL Programming P2 ppt

Nội dung xem thử

Mô tả chi tiết

Chapter 1: Oracle PL/SQL Overview 15

can also call the FORMAT_CALL_STACK or FORMAT_ERROR_STACK from the same package

to work with thrown exceptions.

The following is a simple example:

DECLARE

local_exception EXCEPTION;

FUNCTION nested_local_function

RETURN BOOLEAN IS

retval BOOLEAN := FALSE;

BEGIN

RAISE local_exception;

RETURN retval;

END;

BEGIN

IF nested_local_function THEN

dbms_output.put_line('No raised exception');

END IF;

EXCEPTION

WHEN others THEN

dbms_output.put_line('DBMS_UTILITY.FORMAT_CALL_STACK');

dbms_output.put_line('------------------------------');

dbms_output.put_line(dbms_utility.format_call_stack);

dbms_output.put_line('DBMS_UTILITY.FORMAT_ERROR_BACKTRACE');

dbms_output.put_line('-----------------------------------');

dbms_output.put_line(dbms_utility.format_error_backtrace);

dbms_output.put_line('DBMS_UTILITY.FORMAT_ERROR_STACK');

dbms_output.put_line('-------------------------------');

dbms_output.put_line(dbms_utility.format_error_stack);

END;

/

This script produces the following output:

DBMS_UTILITY.FORMAT_CALL_STACK

------------------------------

----- PL/SQL Call Stack -----

object line object

handle number

name

20909240 18 anonymous block

DBMS_UTILITY.FORMAT_ERROR_BACKTRACE

-----------------------------------

ORA-06512: at line 7

ORA-06512: at line 11

DBMS_UTILITY.FORMAT_ERROR_STACK

-------------------------------

ORA-06510: PL/SQL: unhandled user-defined exception

You will likely find the FORMAT_ERROR_BACKTRACE the most helpful. It captures the line

where the first error occurs at the top, and then moves backward through calls until it arrives at

Tải ngay đi em, còn do dự, trời tối mất!