TAILIEUCHUNG - PL/SQL User's Guide and Reference 10g Release phần 7

Tham khảo tài liệu 'pl/sql user's guide and reference 10g release phần 7', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Defining Object Constructors Calls to methods of an uninitialized object raise the predefined exception NULL_ SELF_DISPATCH. When passed as arguments to IN parameters attributes of an uninitialized object evaluate to NULL. When passed as arguments to OUT or IN OUT parameters they raise an exception if you try to write to them. Accessing Object Attributes You refer to an attribute by name. To access or change the value of an attribute you use dot notation DECLARE r Rational Rational NULL NULL numerator INTEGER denominator INTEGER BEGIN denominator -- Read value of attribute numerator -- Assign value to attribute Attribute names can be chained which lets you access the attributes of a nested object type. For example suppose you define object types Address and Student as follows CREATE TYPE Address AS OBJECT street VARCHAR2 30 city VARCHAR2 20 state CHAR 2 zip_code VARCHAR2 5 CREATE TYPE Student AS OBJECT name VARCHAR2 20 home_address Address phone_number VARCHAR2 10 status VARCHAR2 10 advisor_name VARCHAR2 20 . The Address attribute is an object type that has a zip_code attribute. If s is a Student object you access the value of its zip_code attribute as follows Defining Object Constructors By default you do not need to define a constructor for an object type. The system supplies a default constructor that accepts a parameter corresponding to each attribute. You might also want to define your own constructor To supply default values for some attributes. You can ensure the values are correct instead of relying on the caller to supply every attribute value. To avoid many special-purpose procedures that just initialize different parts of an object. To avoid code changes in applications that call the constructor when new attributes are added to the type. The constructor might need some new code for Using PL SQL Object Types 12-13 Calling Object Constructors example to set the attribute to null but its signature could remain the same so

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.