1 Oracle 8. 2 New features 3 Oracle 8 New features  Abstract data types New features  Abstract data types.

Slides:



Advertisements
Similar presentations
Bordoloi and Bock Chapter 2 :TABLES AND INDEXES. Bordoloi and Bock One of the first steps in creating a database is to create the tables that will store.
Advertisements

Oracle Object-Relational Model. - Structures : tables, views, indexes, etc. - Operations : actions that manipulate data stored in structures - Integrity.
9 Creating and Managing Tables. Objectives After completing this lesson, you should be able to do the following: Describe the main database objects Create.
Data Definition Language (DDL)
Data Modelling Lecture 11: Object-Relational (O-R) Model Nick Rossiter.
PL/SQL.
Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.  Objects  Varray  Nested Table  Transaction Control Language(TCL)
1 A GUIDE TO ORACLE8 CHAPTER 2: Creating and ModifyingDatabaseTables 2.
Oracle Objects Object Oriented Database Approach.
Introduction to PL/SQL Lecture 0 – Self Study Akhtar Ali.
Objectives Why PL-SQL ? Language features
ORACLE ONLINE TRAINING Contact our Support Team : SOFTNSOL India: Skype id : softnsoltrainings id:
CHAPTER 11 Large Objects. Need for Large Objects Data type to store objects that contain large amount of text, log, image, video, or audio data. Most.
Database Design for Object- Relational Systems I. Nested Structures/Methods Nick Rossiter November 2003.
SQL data definition using Oracle1 SQL Data Definition using Oracle.
CS Oct 2006 Section The string abstract data type C++ allows a programmer to add new data or variable types. The details of how this new.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
1 Advanced Databases (CM036): Lecture # 5 ( Object-Relational and Nested-Relational Databases) Introduction to Object-Relational features of Oracle 9i.
6 Copyright © 2009, Oracle. All rights reserved. Working with Composite Data Types.
1 Object-Relational Databases User-Defined Types Nested Tables.
© 2007 by Prentice Hall3-1 Introduction to Oracle 10g Chapter 3 Creating, Modifying, Renaming, and Deleting Database Tables James Perry and Gerald Post.
Chapter 4 Introduction to MySQL. MySQL “the world’s most popular open-source database application” “commonly used with PHP”
JSTL, XML and XSLT An introduction to JSP Standard Tag Library and XML/XSLT transformation for Web layout.
Data Integrity An empty database is a correct database.
INTRODUCTION TO PL/SQL. Class Agenda Introduction Introduction to PL/SQL Declaring PL/SQL Variable Creating the Executable Section Interacting with the.
10 Copyright © 2009, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
1 Copyright © 2006, Oracle. All rights reserved. Using DDL Statements to Create and Manage Tables.
Sizing Basics  Why Size?  When to size  Sizing issues:  Bits and Bytes  Blocks (aka pages) of Data  Different Data types  Row Size  Table Sizing.
CSc-340 3b1 Intermediate SQL Chapter 4 [2 of 2] Phase 1 of Student Projects SQL Data Types & Schemas Authorization.
1 Creating and Modifying Database Objects. 2 An Oracle database consists of multiple user accounts Each user account owns database objects Tables Views.
Chapter Twenty One Collection Data Type Objective: – Composite Data Structures – Introduction of Records – Introduction of Collections – Application of.
C++ PROGRAMMING: PROGRAM DESIGN INCLUDING DATA STRUCTURES, FIFTH EDITION Chapter 10: Strings and string type.
Object-Relational SQL CIS 4301 Lecture Notes 4/20/2006.
PL / SQL By Mohammed Baihan. What is PL/SQL? PL/SQL stands for Procedural Language extension of SQL. PL/SQL is a combination of SQL along with the procedural.
8-1 Copyright  Oracle Corporation, All rights reserved. Objects in Oracle8 1.Object Types - object-relational database 2.Large Objects (LOB) types.
Object relational database managmement systems (ORDBMS) Adapted by Edel Sherratt from originals by Nigel Hardy.
Oracle 8i PL/SQL Collections. Collections A Collection is a group of elements of the same kind There are three types of Collections that you can use in.
Oracle 8i Building PL/SQL Blocks. Creating PL/SQL Blocks CURSORS PROCEDURES FUNCTIONS PACKAGES TRIGGERS CURSORS PROCEDURES FUNCTIONS PACKAGES TRIGGERS.
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
Database Management COP4540, SCS, FIU Physical Database Design (2) (ch. 16 & ch. 6)
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Week 4 Lecture 2 Advanced Table Management. Learning Objectives  Create tables with large object (LOB) columns and tables that are index-organized 
8 Copyright © 2004, Oracle. All rights reserved. Managing Schema Objects.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide Introduction Object Oriented (OO) Data Models since mid-90’s Reasons for creation of.
Fox MIS Spring 2011 Database Week 6 ERD and SQL Exercise.
INTRODUCTION TO SQL Chapter SELECT * FROM teacher WHERE INSTR (subject_id, ‘&1’)= 4 AND LOWER (subject_id) LIKE ‘HST%’ ; When prompted for the.
9 Copyright © 2004, Oracle. All rights reserved. Manipulating Large Objects.
© D. Wong Security and User Authorization in SQL 8.7 pp. 410  Authorization ID = user name  Special authorization ID: PUBLIC  Privileges for:
Oracle & SQL. Oracle Data Types Character Data Types: Char(2) Varchar (20) Clob: large character string as long as 4GB Bolb and bfile: large amount of.
SLIDE 1IS 257 – Fall 2014 NoSQL Databases University of California, Berkeley School of Information IS 257: Database Management.
Feb-16WIJIS Messaging Model G. W. Pasdirtz, Ph.D., WIJIS Joe Mierwa, Visionair.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 4: Intermediate.
1 Part IV: Object-Relational Databases  Ch. 30: Types, Object Views, Methods  Ch. 31: Nested Tables and Varying Arrays  Ch. 32: Large Objects  Ch.
Marcel VanLandeghem Website ait.saultcollege.ca/marcel.vanlandeghem.
6 Copyright © 2004, Oracle. All rights reserved. Working with Composite Data Types.
Oracle 9i Collections. Composite types Several variables as single unit ◦ Records  Different datatype variables are combined here  Ex: All fields of.
8 Copyright © 2005, Oracle. All rights reserved. Managing Schema Objects.
Composite data types_ PL/SQL table. Composite data types PL/SQL provides three composite data types : TABLE, ROCORD, and VARRAY. Objects of type TABLE.
Lec-7. The IN Operator The IN operator allows you to specify multiple values in a WHERE clause. SQL IN Syntax SELECT column_name(s) FROM table_name WHERE.
CS422 Principles of Database Systems Object-Oriented Features in DBMS Chengyu Sun California State University, Los Angeles.
PLSQL Cont…. Most Common Oracle Data Types VARCHAR2 –Stores variable-length character data. –Takes a required parameter that specifies a maximum length.
2b. Create an Access Database Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1.
Object-Relational Databases
Object-Relational DBMSs
All Powder Board and Ski
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
This allows me to insert data for specified fields and not for other fields in the structure.
Object-Relational Features
PL/SQL Declaring Variables.
Object – relational database
Presentation transcript:

1 Oracle 8

2 New features

3 Oracle 8 New features  Abstract data types New features  Abstract data types

4 Oracle 8 New features  Abstract data types  Nested tables New features  Abstract data types  Nested tables

5 Oracle 8 New features  Abstract data types  Nested tables  Varying arrays New features  Abstract data types  Nested tables  Varying arrays

6 Oracle 8 New features  Abstract data types  Nested tables  Varying arrays  Large objects New features  Abstract data types  Nested tables  Varying arrays  Large objects

7 Oracle 8 New features  Abstract data types  Nested tables  Varying arrays  Large objects  References New features  Abstract data types  Nested tables  Varying arrays  Large objects  References

8 Oracle 8 New features  Abstract data types  Nested tables  Varying arrays  Large objects  References  Object views New features  Abstract data types  Nested tables  Varying arrays  Large objects  References  Object views

9 Oracle 8 Abstract data types

10 Oracle 8 Abstract data types  CREATE TYPE statement CREATE TYPE ADDRESS_TYPE AS OBJECT (StreetVARCHAR2(50), CityVARCHAR2(25), StateVARCHAR(3), ZipNUMBER(4)); Abstract data types  CREATE TYPE statement CREATE TYPE ADDRESS_TYPE AS OBJECT (StreetVARCHAR2(50), CityVARCHAR2(25), StateVARCHAR(3), ZipNUMBER(4));

11 Oracle 8 Abstract data types  CREATE TYPE statement CREATE TYPE ADDRESS_TYPE AS OBJECT (StreetVARCHAR2(50), CityVARCHAR2(25), StateVARCHAR(3), ZipNUMBER(4)); CREATE TYPE PERSON_TYPE AS OBJECT (NameVARCHAR2(30), AddressADDRESS_TYPE); Abstract data types  CREATE TYPE statement CREATE TYPE ADDRESS_TYPE AS OBJECT (StreetVARCHAR2(50), CityVARCHAR2(25), StateVARCHAR(3), ZipNUMBER(4)); CREATE TYPE PERSON_TYPE AS OBJECT (NameVARCHAR2(30), AddressADDRESS_TYPE);

12 Oracle 8 Abstract data types  CREATE TABLE statement CREATE TABLE CUSTOMER (Customer_IDNUMBER(6), PersonPERSON_TYPE ); Abstract data types  CREATE TABLE statement CREATE TABLE CUSTOMER (Customer_IDNUMBER(6), PersonPERSON_TYPE );

13 Oracle 8 Abstract data types  CREATE TABLE statement CREATE TABLE CUSTOMER (Customer_IDNUMBER(6), PersonPERSON_TYPE ); CREATE TABLE DEPARTMENT (Dept_NameVARCHAR2(20), AddressADDRESS_TYPE)); Abstract data types  CREATE TABLE statement CREATE TABLE CUSTOMER (Customer_IDNUMBER(6), PersonPERSON_TYPE ); CREATE TABLE DEPARTMENT (Dept_NameVARCHAR2(20), AddressADDRESS_TYPE));

14 Oracle 8 Abstract data types  INSERT INTO statement INSERT INTO CUSTOMER VALUES ( 1, PERSON_TYPE(‘Mike Jones’, ADDRESS_TYPE(‘Penny St.’, ‘London’, ‘HK’, 1234))); Abstract data types  INSERT INTO statement INSERT INTO CUSTOMER VALUES ( 1, PERSON_TYPE(‘Mike Jones’, ADDRESS_TYPE(‘Penny St.’, ‘London’, ‘HK’, 1234)));

15 Oracle 8 Abstract data types  INSERT INTO statement INSERT INTO CUSTOMER VALUES ( 1, PERSON_TYPE(‘Mike Jones’, ADDRESS_TYPE(‘Penny St.’, ‘London’, ‘HK’, 1234))); INSERT INTO DEPARTMENT VALUES( ‘SITACS’, ADDRESS_TYPE(‘Northfields Ave.’, ‘Wollongong’, ‘NSW’, 2522) ); Abstract data types  INSERT INTO statement INSERT INTO CUSTOMER VALUES ( 1, PERSON_TYPE(‘Mike Jones’, ADDRESS_TYPE(‘Penny St.’, ‘London’, ‘HK’, 1234))); INSERT INTO DEPARTMENT VALUES( ‘SITACS’, ADDRESS_TYPE(‘Northfields Ave.’, ‘Wollongong’, ‘NSW’, 2522) );

16 Oracle 8 Abstract data types  SELECT statement –SELECT Customer_id, Person.Name –FROM Customer –WHERE Person.Address.City = ‘London’; –SELECT * –FROM Department; Abstract data types  SELECT statement –SELECT Customer_id, Person.Name –FROM Customer –WHERE Person.Address.City = ‘London’; –SELECT * –FROM Department;

17 Oracle 8 Abstract data types  DROP TYPE statement DROP TYPE PERSON_TYPE Abstract data types  DROP TYPE statement DROP TYPE PERSON_TYPE

18 Oracle 8 Abstract data types  DROP TYPE statement DROP TYPE PERSON_TYPE  CREATE OR REPLACE TYPE statement CREATE OR REPLACE TYPE ADDRESS_TYPE AS OBJECT (StreetVARCHAR2(50), CityVARCHAR2(25) ); Abstract data types  DROP TYPE statement DROP TYPE PERSON_TYPE  CREATE OR REPLACE TYPE statement CREATE OR REPLACE TYPE ADDRESS_TYPE AS OBJECT (StreetVARCHAR2(50), CityVARCHAR2(25) );

19 Oracle 8 Indexing abstract data type attributes

20 Oracle 8 Indexing abstract data type attributes  CREATE INDEX statement CREATE INDEX CUST_IDX ON Customer(Person.Address.City) ; Indexing abstract data type attributes  CREATE INDEX statement CREATE INDEX CUST_IDX ON Customer(Person.Address.City) ;

21 Oracle 8 Object views

22 Oracle 8 Object views CREATE TABLE CUSTOMER (Customer_IdNUMBER(6) PRIMARY KEY, NameVARCHAR2(30), StreetVARCHAR2(50), CityVARCHAR2(20), StateCHAR(3), ZipNUMBER(4)); Object views CREATE TABLE CUSTOMER (Customer_IdNUMBER(6) PRIMARY KEY, NameVARCHAR2(30), StreetVARCHAR2(50), CityVARCHAR2(20), StateCHAR(3), ZipNUMBER(4));

23 Oracle 8 Object views CREATE TYPE ADDRESS_TYPE AS OBJECT StreetVARCHAR2(50), CityVARCHAR2(20), StateCHAR(3), ZipNUMBER(4)); Object views CREATE TYPE ADDRESS_TYPE AS OBJECT StreetVARCHAR2(50), CityVARCHAR2(20), StateCHAR(3), ZipNUMBER(4));

24 Oracle 8 Object views CREATE TYPE ADDRESS_TYPE AS OBJECT StreetVARCHAR2(50), CityVARCHAR2(20), StateCHAR(3), ZipNUMBER(4)); CREATE TYPE PERSON_TYPE AS OBJECT (NameVARCHAR2(30), AddressADDRESS_TYPE); Object views CREATE TYPE ADDRESS_TYPE AS OBJECT StreetVARCHAR2(50), CityVARCHAR2(20), StateCHAR(3), ZipNUMBER(4)); CREATE TYPE PERSON_TYPE AS OBJECT (NameVARCHAR2(30), AddressADDRESS_TYPE);

25 Oracle 8 Object views CREATE VIEW CUSTOMER_V (Customer_ID, Person) AS SELECT Customer_ID, PERSON_TYPE(Name, ADDRESS_TYPE(Street, City, State,Zip) ) FROMCUSTOMER WHEREState = ‘NSW’; Object views CREATE VIEW CUSTOMER_V (Customer_ID, Person) AS SELECT Customer_ID, PERSON_TYPE(Name, ADDRESS_TYPE(Street, City, State,Zip) ) FROMCUSTOMER WHEREState = ‘NSW’;

26 Oracle 8 Object views  Create flat relational table Object views  Create flat relational table

27 Oracle 8 Object views  Create flat relational table  Create abstract data types Object views  Create flat relational table  Create abstract data types

28 Oracle 8 Object views  Create flat relational table  Create abstract data types  Create object view Object views  Create flat relational table  Create abstract data types  Create object view

29 Oracle 8 Methods

30 Oracle 8 Methods CREATE TYPE PERSON_TYPE AS OBJECT (NameVARCHAR2(30), AddressADDRESS_TYPE, BithDateDATE, MEMBER FUNCTION Age( BirthDate IN DATE) RETURN NUMBER ); Methods CREATE TYPE PERSON_TYPE AS OBJECT (NameVARCHAR2(30), AddressADDRESS_TYPE, BithDateDATE, MEMBER FUNCTION Age( BirthDate IN DATE) RETURN NUMBER );

31 Oracle 8 Methods CREATE TYPE BODY PERSON_TYPE AS MEMBER FUNCTION Age( BirthDate IN DATE) RETURN NUMBER IS BEGIN RETURN ROUND(SysDate - BirthDate); END; / Methods CREATE TYPE BODY PERSON_TYPE AS MEMBER FUNCTION Age( BirthDate IN DATE) RETURN NUMBER IS BEGIN RETURN ROUND(SysDate - BirthDate); END; /

32 Oracle 8 Methods CREATE TABLE STUDENT (SIDNUMBER(6), PERSONPERSON_TYPE ); SELECT STUDENT.Age(Student.BirthDate) FROM STUDENT; Methods CREATE TABLE STUDENT (SIDNUMBER(6), PERSONPERSON_TYPE ); SELECT STUDENT.Age(Student.BirthDate) FROM STUDENT;

33 Oracle 8 Collectors

34 Oracle 8 Collectors  Varying arrays Collectors  Varying arrays

35 Oracle 8 Collectors  Varying arrays  Nested tables Collectors  Varying arrays  Nested tables

36 Oracle 8 Varying arrays

37 Oracle 8 Varying arrays CREATE TYPE TOOL_TYPE AS OBJECT (ToolNameVARCHAR2(30) ); Varying arrays CREATE TYPE TOOL_TYPE AS OBJECT (ToolNameVARCHAR2(30) );

38 Oracle 8 Varying arrays CREATE TYPE TOOL_TYPE AS OBJECT (ToolNameVARCHAR2(30) ); CREATE TYPE TOOLS_VA AS VARRAY(5) OF TOOL_TYPE; Varying arrays CREATE TYPE TOOL_TYPE AS OBJECT (ToolNameVARCHAR2(30) ); CREATE TYPE TOOLS_VA AS VARRAY(5) OF TOOL_TYPE;

39 Oracle 8 Varying arrays CREATE TYPE TOOL_TYPE AS OBJECT (ToolNameVARCHAR2(30) ); CREATE TYPE TOOLS_VA AS VARRAY(5) OF TOOL_TYPE; CREATE TABLE MECHANIC (NameVARCHAR2(30) PRIMARY KEY, ToolsTOOLS_VA ); Varying arrays CREATE TYPE TOOL_TYPE AS OBJECT (ToolNameVARCHAR2(30) ); CREATE TYPE TOOLS_VA AS VARRAY(5) OF TOOL_TYPE; CREATE TABLE MECHANIC (NameVARCHAR2(30) PRIMARY KEY, ToolsTOOLS_VA );

40 Oracle 8 Varying arrays INSERT INTO MECHANIC VALUES (‘Mike Jones’, TOOLS_VA(TOOL_TYPE(‘HAMMER’), TOOL_TYPE(‘SLEDGE’), TOOL_TYPE(‘AX’))); Varying arrays INSERT INTO MECHANIC VALUES (‘Mike Jones’, TOOLS_VA(TOOL_TYPE(‘HAMMER’), TOOL_TYPE(‘SLEDGE’), TOOL_TYPE(‘AX’)));

41 Oracle 8 Varying arrays DECLARE CURSOR MECHANIC_CURSOR IS SELECT * FROM MECHANIC; MECHANIC_REC MECHANIC_CURSOR%ROWTYPE; BEGIN FOR MECHANIC_REC IN MECHANIC_CURSOR LOOP DBMS_OUTPUT.PUT_LINE(MECHANIC_REC.Name); FOR I IN 1..MECHANIC_REC.Tools.Count LOOP DBMS_OUTPUT.PUT_LINE(MECHANIC_REC.Tools(I)); END LOOP; END; Varying arrays DECLARE CURSOR MECHANIC_CURSOR IS SELECT * FROM MECHANIC; MECHANIC_REC MECHANIC_CURSOR%ROWTYPE; BEGIN FOR MECHANIC_REC IN MECHANIC_CURSOR LOOP DBMS_OUTPUT.PUT_LINE(MECHANIC_REC.Name); FOR I IN 1..MECHANIC_REC.Tools.Count LOOP DBMS_OUTPUT.PUT_LINE(MECHANIC_REC.Tools(I)); END LOOP; END;

42 Oracle 8 Nested tables

43 Oracle 8 Nested tables CREATE TYPE ANIMAL_TYPE AS OBJECT (BreedVARCHAR2(30), NameVARCHAR2(20), BirthdateDATE ); Nested tables CREATE TYPE ANIMAL_TYPE AS OBJECT (BreedVARCHAR2(30), NameVARCHAR2(20), BirthdateDATE );

44 Oracle 8 Nested tables CREATE TYPE ANIMAL_TYPE AS OBJECT (BreedVARCHAR2(30), NameVARCHAR2(20), BirthdateDATE ); CREATE TYPE ANIMAL_TABLE AS TABLE OF ANIMAL_TYPE; Nested tables CREATE TYPE ANIMAL_TYPE AS OBJECT (BreedVARCHAR2(30), NameVARCHAR2(20), BirthdateDATE ); CREATE TYPE ANIMAL_TABLE AS TABLE OF ANIMAL_TYPE;

45 Oracle 8 Nested tables CREATE TYPE ANIMAL_TYPE AS OBJECT (BreedVARCHAR2(30), NameVARCHAR2(20), BirthdateDATE ); CREATE TYPE ANIMAL_TABLE AS TABLE OF ANIMAL_TYPE; CREATE TABLE BREEDER (BreederNameVARCHAR2(30), AnimalsANIMAL_TABLE) NESTED TABLE ANIMALS STORE AS ANIMALS_NT; Nested tables CREATE TYPE ANIMAL_TYPE AS OBJECT (BreedVARCHAR2(30), NameVARCHAR2(20), BirthdateDATE ); CREATE TYPE ANIMAL_TABLE AS TABLE OF ANIMAL_TYPE; CREATE TABLE BREEDER (BreederNameVARCHAR2(30), AnimalsANIMAL_TABLE) NESTED TABLE ANIMALS STORE AS ANIMALS_NT;

46 Oracle 8 Nested tables INSERT INTO BREEDER VALUES (‘Mike Jones’, ANIMAL_TABLE( ANIMAL_TYPE( ‘DOG’, ‘BUTCH’, ‘31-MAR-97’), ANIMAL_TYPE( ‘CAT’, ‘ROVER’, ‘1-MAR-98’), ANIMAL_TYPE( ‘RAT’, ‘JULIO’, 12-MAR-79’) ) ); Nested tables INSERT INTO BREEDER VALUES (‘Mike Jones’, ANIMAL_TABLE( ANIMAL_TYPE( ‘DOG’, ‘BUTCH’, ‘31-MAR-97’), ANIMAL_TYPE( ‘CAT’, ‘ROVER’, ‘1-MAR-98’), ANIMAL_TYPE( ‘RAT’, ‘JULIO’, 12-MAR-79’) ) );

47 Oracle 8 Nested tables SELECT NT.BirthDate FROM THE(SELECTAnimals FROMBREEDER WHEREBreederName = ‘Jane James’; ) NT WHERE NT.name = ‘Julio’; Nested tables SELECT NT.BirthDate FROM THE(SELECTAnimals FROMBREEDER WHEREBreederName = ‘Jane James’; ) NT WHERE NT.name = ‘Julio’;

48 Oracle 8 Nested tables INSERT INTO THE(SELECTAnimals FROMBREEDER WHEREBreederName =‘Mike Jones’) VALUES (ANIMAL_TYPE( ‘DOG, ‘MARCUS’, ‘01-AUG-97’) ); Nested tables INSERT INTO THE(SELECTAnimals FROMBREEDER WHEREBreederName =‘Mike Jones’) VALUES (ANIMAL_TYPE( ‘DOG, ‘MARCUS’, ‘01-AUG-97’) );

49 Oracle 8 Nested tables INSERT INTO BREEDER VALUES (‘Joan Thomas’, cast(multiset( SELECT * FROM THE(SELECTAnimals FROMBREEDER WHEREBreederName = ‘Jane James’)) AS ANIMAL_TABLE ) ); Nested tables INSERT INTO BREEDER VALUES (‘Joan Thomas’, cast(multiset( SELECT * FROM THE(SELECTAnimals FROMBREEDER WHEREBreederName = ‘Jane James’)) AS ANIMAL_TABLE ) );

50 Oracle 8 Object tables

51 Oracle 8 Object tables CREATE TYPE ANIMAL_TYPE AS OBJECT (BreedVARCHAR2(30), NameVARCHAR2(20), BirthdateDATE ); CREATE TABLE ANIMAL OF ANIMAL_TYPE; Object tables CREATE TYPE ANIMAL_TYPE AS OBJECT (BreedVARCHAR2(30), NameVARCHAR2(20), BirthdateDATE ); CREATE TABLE ANIMAL OF ANIMAL_TYPE;

52 Oracle 8 REF operator

53 Oracle 8 REF operator SELECTREF(A) FROM ANIMAL A WHEREName = ‘Francis’; REF operator SELECTREF(A) FROM ANIMAL A WHEREName = ‘Francis’;

54 Oracle 8 DEREF operator

55 Oracle 8 DEREF operator CREATE TABLE ANIMAL OF ANIMAL_TYPE; CREATE TABLE KEEPER (KeeperNameVARCHAR2(30), AnimalKeptREF ANIMAL_TYPE ) DEREF operator CREATE TABLE ANIMAL OF ANIMAL_TYPE; CREATE TABLE KEEPER (KeeperNameVARCHAR2(30), AnimalKeptREF ANIMAL_TYPE )

56 Oracle 8 DEREF operator CREATE TABLE ANIMAL OF ANIMAL_TYPE; CREATE TABLE KEEPER (KeeperNameVARCHAR2(30), AnimalKeptREF ANIMAL_TYPE ) INSERT INTO KEEPER SELECT ‘Kate’, REF(A) FROM ANIMAL A WHERE Name = ‘Benji’; DEREF operator CREATE TABLE ANIMAL OF ANIMAL_TYPE; CREATE TABLE KEEPER (KeeperNameVARCHAR2(30), AnimalKeptREF ANIMAL_TYPE ) INSERT INTO KEEPER SELECT ‘Kate’, REF(A) FROM ANIMAL A WHERE Name = ‘Benji’;

57 Oracle 8 DEREF operator SELECT DEREF(K.AnimalKept) FROM KEEPER K WHERE KeeperName = ‘Kate’; DEREF operator SELECT DEREF(K.AnimalKept) FROM KEEPER K WHERE KeeperName = ‘Kate’;

58 Oracle 8 VALUE operator

59 Oracle 8 VALUE operator SELECT VALUE(A) FROM ANIMAL A WHERE NAME = ‘Benji’; VALUE operator SELECT VALUE(A) FROM ANIMAL A WHERE NAME = ‘Benji’;

60 Oracle 8 Generation of OIDs CREATE TYPE CUSTOMER_TYPE AS OBJECT (Customer_IDNUMBERPRIMARY KEY, NameVARCHAR(30), StreetVARCHAR2(20), CityVARCHAR2(20), StateCHAR(3) ZipNUMBER(4)); CREATE VIEW CUSTOMER_OBJ OF CUSTOMER_TYPE WITH OBJECT OID(Customer_ID) AS SELECT * FROM Customer; Generation of OIDs CREATE TYPE CUSTOMER_TYPE AS OBJECT (Customer_IDNUMBERPRIMARY KEY, NameVARCHAR(30), StreetVARCHAR2(20), CityVARCHAR2(20), StateCHAR(3) ZipNUMBER(4)); CREATE VIEW CUSTOMER_OBJ OF CUSTOMER_TYPE WITH OBJECT OID(Customer_ID) AS SELECT * FROM Customer;

61 Oracle 8 Generation of OIDs CREATE VIEW CUSTOMER_CALL_OBJ AS SELECT MAKE_REF(CUSTOMER_OBJECT, Customer ID) Customer_ID, CallNumber, CallDate FROM Customer_Call; Generation of OIDs CREATE VIEW CUSTOMER_CALL_OBJ AS SELECT MAKE_REF(CUSTOMER_OBJECT, Customer ID) Customer_ID, CallNumber, CallDate FROM Customer_Call;

62 Oracle 8 Generation of OIDs SELECT DEREF(CCOV.Customer_ID) FROM CUSTOMER_CALL_OBJECT WHERE CallDate = TRUNC(SysDate); Generation of OIDs SELECT DEREF(CCOV.Customer_ID) FROM CUSTOMER_CALL_OBJECT WHERE CallDate = TRUNC(SysDate);

63 Oracle 8 Large Objects

64 Oracle 8 Large Objects  BLOB Binary LOB. It contains binary data up to 4GB in length and it is stored in the database Large Objects  BLOB Binary LOB. It contains binary data up to 4GB in length and it is stored in the database

65 Oracle 8 Large Objects  BLOB Binary LOB. It contains binary data up to 4GB in length and it is stored in the database  CLOB Character LOB. It contains character data up to 4GB in length and it is stored in the database Large Objects  BLOB Binary LOB. It contains binary data up to 4GB in length and it is stored in the database  CLOB Character LOB. It contains character data up to 4GB in length and it is stored in the database

66 Oracle 8 Large Objects  BLOB Binary LOB. It contains binary data up to 4GB in length and it is stored in the database  CLOB Character LOB. It contains character data up to 4GB in length and it is stored in the database  BFILE Binary file. It contains read-only binary data stored outside the database and its length is limited by operating system Large Objects  BLOB Binary LOB. It contains binary data up to 4GB in length and it is stored in the database  CLOB Character LOB. It contains character data up to 4GB in length and it is stored in the database  BFILE Binary file. It contains read-only binary data stored outside the database and its length is limited by operating system

67 Oracle 8 Large Objects CREATE TABLE Proposal (Proposal_IDNUMBER(10) PRIMARY KEY, NameVARCHAR2(30), ShortDescriptionVARCHAR2(1000), ProposalTextCLOB, BudgetBLOB, CoverLetterBFILE ); Large Objects CREATE TABLE Proposal (Proposal_IDNUMBER(10) PRIMARY KEY, NameVARCHAR2(30), ShortDescriptionVARCHAR2(1000), ProposalTextCLOB, BudgetBLOB, CoverLetterBFILE );

68 Oracle 8 Large Objects INSERT INTO Proposal VALUES ( 123, ‘Nuclear reactor’, ‘This is a short decription’, ‘This is a text of full proposal’, EMPTY_BLOB(), NULL); Large Objects INSERT INTO Proposal VALUES ( 123, ‘Nuclear reactor’, ‘This is a short decription’, ‘This is a text of full proposal’, EMPTY_BLOB(), NULL);

69 Oracle 8 DBMS_LOB package  READ Read a pice of a LOB value  SUBSTR Select a piece of a LOB value  INSTR Insert a piece of a LOB value  GETLENGHT Find the length of a LOB value DBMS_LOB package  READ Read a pice of a LOB value  SUBSTR Select a piece of a LOB value  INSTR Insert a piece of a LOB value  GETLENGHT Find the length of a LOB value

70 Oracle 8 DBMS_LOB package  COMPARE Compare two LOB values  WRITE Write a piece of a LOB value  APPEND Append a piece of a LOB value  ERASE Erase a piece of a LOB value DBMS_LOB package  COMPARE Compare two LOB values  WRITE Write a piece of a LOB value  APPEND Append a piece of a LOB value  ERASE Erase a piece of a LOB value

71 Oracle 8 References  /share/cs-pub/235/docs/SQLRef.pdf  /share/cs-pub/235/docs/PLSQLRef.pdf References  /share/cs-pub/235/docs/SQLRef.pdf  /share/cs-pub/235/docs/PLSQLRef.pdf