TAILIEUCHUNG - ORACLE8i- P10

ORACLE8i- P10: We want information information.” Possibly you recognize these words as the primary interest of a somewhat clandestine group, and as told by a character called Number 2 to Patrick McGoohan’s character Number 6 (in the old TV show The Prisoner). Indeed, in this day, information is king, and the speedy, accurate, and reliable retrieval of this information is paramount. | 352 I CHAPTER 8 ORACLE OBJECT-ORIENTED FEATURES Another option for an object table is to define the primary key of the table to be the OID using the OID clause of the CREATE TABLE statement. If you use the primary key as the OID for the table it will only be unique to the table itself. This is an alternative to using the default system-generated OID a 128 byte base 64 number which is globally unique throughout the database. If you specify that the table should use the system-generated OID then you will want to specify the STORAGE clauses for the related OID index that will be created. Thus using the system-generated OID will require more storage space than using the primary key. Listing provides an example of the creation of both the child and the parent object tables using a few of the options just described. Listing Creating Object Tables Drop all types and tables to make this easier. DROP TABLE child DROP TABLE parent DROP TYPE parent_type FORCE DROP TYPE child_type FORCE CREATE OR REPLACE TYPE name_type AS OBJECT First_name VARCHAR2 30 Last_name VARCHAR2 30 Middle_init CHAR 1 Create our forward type declaration for the child_type type so we can create the parent_type type. CREATE OR REPLACE TYPE child_type Create the parent_type type. Note the two REFs to the child_type. CREATE OR REPLACE TYPE parent_type AS OBJECT Parent_id NUMBER Parent_name name_type Parent_address address_type Child_name REF child_type Exch_student REF child_type Please purchase PDF Split-MJe 9e n to removebihis watermark. USING OBJECT TABLES 353 Now create the child_type. Again note the REFs to the parent_type type. CREATE OR REPLACE TYPE child_type AS OBJECT Parent_id REF parent_type Child_id NUMBER Child_name name_type Child_address address_type Teacher REF parent_type Now create the parent table. We will use an OID index for this table. This is generally required for the main table in a parent child relationship. The OIDINDEX clause will help speed up REF lookups

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.