Creating Object Types

The CREATE TYPE statement creates an object type. The following code creates a type:


SQL> CREATE TYPE t_address AS OBJECT (
  2      street VARCHAR2(15),
  3      city VARCHAR2(15),
  4      state CHAR(2),
  5      zip VARCHAR2(5)
  6  );
  7  /

Type created.

You can reference the type just created:


SQL> CREATE TYPE t_person AS OBJECT (
  2      id INTEGER,
  3      first_name VARCHAR2(10),
  4      last_name VARCHAR2(10),
  5      dob DATE,
  6      phone VARCHAR2(12),
  7      address t_address
  8  );
  9  /

Type created.
Home »
Oracle »
PL/SQL » 

Object Types:
  1. Creating Object Types
  2. A type with member function:
  3. Using DESCRIBE to Get Information on Object Types
  4. Using Object Types in Database Tables
  5. Retrieve an individual column object from a table
  6. Call method from type
  7. UPDATE/DELETE row based on custom data type
  8. Object Tables
  9. VALUE() selects a row from an object table.
  10. UPDATE Object Table
  11. DELETE rows from Object Table
  12. Object table abased on nested types
  13. Object Identifiers and Object References
  14. REF type for an object reference
  15. Retrieve the actual objects stored in an object reference using the DEREF() function,
  16. Comparing Object Values
Related: