Nordic (15)


This series is a commentary of sorts on a PowerPoint™ presentation called Nordic – Object Relational Database Design. We are still at slide #73 of the presentation.

Complex Collection

Based on what we have done in Nordic (13) and Nordic (14), this example is relatively simple to implement. First, create the consituent types using the CREATE TYPE command:

CREATE OR REPLACE TYPE classroom_typ AS OBJECT (
  room_no NUMBER
)
FINAL;
/
CREATE OR REPLACE TYPE teacher_typ AS OBJECT (
  name VARCHAR2( 30 )
)
FINAL;
/
CREATE OR REPLACE TYPE teacher_asst_typ AS OBJECT (
  name VARCHAR2( 30 )
)
FINAL;
/
CREATE OR REPLACE TYPE student_typ AS OBJECT (
  name VARCHAR2( 30 )
)
FINAL;
/
CREATE OR REPLACE TYPE desk_typ AS OBJECT (
  position NUMBER
)
FINAL;
/
CREATE OR REPLACE TYPE computer_typ AS OBJECT (
  serial_no NUMBER
)
FINAL;
/

Now create the collection types:

CREATE OR REPLACE TYPE student_arr AS VARRAY( 25 ) OF student_typ;
/
CREATE OR REPLACE TYPE desks_arr AS VARRAY( 28 ) OF desk_typ;
/
CREATE OR REPLACE TYPE computer_arr AS VARRAY( 8 ) OF computer_typ;
/

Now create the final type:

CREATE OR REPLACE TYPE school_class_typ AS OBJECT (
  classroom classroom_typ,
  teacher   teacher_typ,
  teacher_assistant
            teacher_asst_typ,
  students  student_arr,
  desks     desks_arr,
  computers computer_arr
)
FINAL;
/

And with that we come to the end of the presentation.

Conclusion

I think that I have been able to demonstrate that almost all of the features provided by Nordic are available in Oracle 10.2. The exceptions being the association enquiries as demonstrated in

Nordic (12).

All Done

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s