TAILIEUCHUNG - Oracle Database 10g The Complete Reference phần 6

Tham khảo tài liệu 'oracle database 10g the complete reference phần 6', 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ả | 658 Part V Object-Relational Databases back to CUSTOMER you cannot record a call for a customer who does not already have a record in CUSTOMER. A single nonkey attribute Call_Date is created within the CUSTOMER_CALL table. l . create table CUSTOMER_CALL Customer_ID NUMBER Call_Number NUMBER Call_Date DATE constraint CUSTOMER_CALL_PK primary key Customer_ID Call_Number constraint CUSTOMER_CALL_FK foreign key Customer_ID references CUSTOMER Customer_ID For example you could have the following CUSTOMER and CUSTOMER_CALL entries insert into CUSTOMER values 123 SIGMUND 47 HAFFNER RD LEWISTON NJ 22222 insert into CUSTOMER values 234 EVELYN 555 HIGH ST LOWLANDS PARK NE 33333 insert into CUSTOMER_CALL values 123 1 TRUNC SysDate -1 insert into CUSTOMER_CALL values 123 2 TRUNC SysDate The foreign key from CUSTOMER_CALL to CUSTOMER defines the relationship between the tables. From an OOP point of view the records in CUSTOMER_CALL reference the records in CUSTOMER. Therefore we must find a way to assign OID values to the records in CUSTOMER and generate references in CUSTOMER_CALL. How to Generate OIDs First use an object view to assign OIDs to the records in CUSTOMER. Remember that OIDs are assigned to records in an object table and an object table in turn is based on an abstract datatype. Therefore we first need to create an abstract datatype that has the same structure as the CUSTOMER table create or replace type CUSTOMER_TY as object Customer_ID NUMBER Name VARCHAR2 25 Street VARCHAR2 50 City VARCHAR2 25 State CHAR 2 Zip NUMBER Now create an object view based on the CUSTOMER_TY type while assigning OID values to the records in CUSTOMER agR X---j create or replace view CUSTOMER_OV of CUSTOMER_TY with object identifier Customer_ID as Chapter 36 Advanced Object-Oriented Concepts 659 select Customer_ID Name Street City State Zip from CUSTOMER The first part of this create view command gives the view its name CUSTOMER_OV and tells Oracle that the view s structure is based .

TÀI LIỆU LIÊN QUAN
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.