TAILIEUCHUNG - PL/SQL User’s Guide and Reference phần 6

Tuyên bố trường hợp ngoại lệ Trường hợp ngoại lệ có thể chỉ được khai báo trong phần khai báo của một khối PL / SQL, Tiểu chương, hoặc gói. Bạn khai báo là một ngoại lệ bằng cách giới thiệu tên của nó, theo sau bởi các EXCEPTION từ khóa. Trong ví dụ sau đây, bạn khai báo một trường hợp ngoại lệ có tên là past_due: DECLARE EXCEPTION past_due; | What Is a Package What Is a Package A package is a schema object that groups logically related PL SQL types items and subprograms. Packages usually have two parts a specification and a body although sometimes the body is unnecessary. The specification spec for short is the interface to your applications it declares the types variables constants exceptions cursors and subprograms available for use. The body fully defines cursors and subprograms and so implements the spec. As Figure 8-1 shows you can think of the spec as an operational interface and of the body as a black box. You can debug enhance or replace a package body without changing the interface package spec to the package. Package Figure 8-1 Package Interface Application Database specification body To create packages use the CREATE PACKAGE statement which you can execute interactively from SQL Plus. Here is the syntax CREATE OR REPLACE PACKAGE package_name AUTHID CURRENT_USER DEFINeR is as PRAGMA SERIALLY_REUSABLE collection_type_definition . record_type_definition . subtype_definition . collection_declaration . constant_declaration . exception_declaration . object_declaration . record_declaration . variable_declaration . 8-2 PL SQL User s Guide and Reference What Is a Package cursor_spec . function_spec . procedure_spec . call_spec . PRAGMA RESTRICT_REFERENCES assertions . END package_name CREATE OR REPLACE PACKAGE BODY package_name is as PRAGMA SERIALLY_REUSABLE collection_type_definition . record_type_definition . subtype_definition . collection_declaration . constant_declaration . exception_declaration . object_declaration . record_declaration . variable_declaration . cursor_body . function_spec . procedure_spec . call_spec . BEGIN sequence_of_statements END package_name The spec holds public declarations which are visible to your application. The body holds implementation details and private declarations which are hidden from your application. Following the declarative part of the package body is the .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.