SQL>
SQL>
SQL> CREATE OR REPLACE TYPE courseType AS OBJECT
2 (course_id VARCHAR2(10),
3 course_name VARCHAR2(30))
4 /
Type created.
SQL>
SQL> CREATE OR REPLACE TYPE bookType AS OBJECT
2 (book_id VARCHAR2(10),
3 book_title VARCHAR2(30),
4 course_book REF courseType)
5 /
Type created.
SQL>
SQL> CREATE TABLE Course OF courseType
2 (course_id NOT NULL,
3 PRIMARY KEY (course_id));
Table created.
SQL>
SQL> CREATE TABLE Book OF bookType
2 (book_id NOT NULL,
3 PRIMARY KEY (book_id));
Table created.
SQL>
SQL> CREATE TABLE Require
2 (Book REF bookType,
3 Index_Book NUMBER NOT NULL,
4 Course REF courseType);
Table created.
SQL>
SQL> drop type courseType force;
Type dropped.
SQL> drop type bookType force;
Type dropped.
SQL> drop table Course;
Table dropped.
SQL> drop table Book;
Table dropped.
SQL> drop table Require;
Table dropped.
|