Using DESCRIBE to Get Information on Object Types

You can use the DESCRIBE command to get information on an object type.


CREATE TYPE t_address AS OBJECT (
    street VARCHAR2(15),
    city VARCHAR2(15),
    state CHAR(2),
    zip VARCHAR2(5)
);
/

CREATE TYPE t_person AS OBJECT (
    id INTEGER,
    first_name VARCHAR2(10),
    last_name VARCHAR2(10),
    dob DATE,
    phone VARCHAR2(12),
    address t_address
);
/

SQL> DESCRIBE t_address
 Name                                      Null?    Type
 ----------------------------------------- -------- -------------------

 STREET                                             VARCHAR2(15)
 CITY                                               VARCHAR2(15)
 STATE                                              CHAR(2)
 ZIP                                                VARCHAR2(5)

SQL>

Show more levels for embedded types.


SQL> SET DESCRIBE DEPTH 2
SQL> DESCRIBE t_person
 Name                                      Null?    Type
 ----------------------------------------- -------- -------------------------

 ID                                                 NUMBER(38)
 FIRST_NAME                                         VARCHAR2(10)
 LAST_NAME                                          VARCHAR2(10)
 DOB                                                DATE
 PHONE                                              VARCHAR2(12)
 ADDRESS                                            T_ADDRESS
   STREET                                           VARCHAR2(15)
   CITY                                             VARCHAR2(15)
   STATE                                            CHAR(2)
   ZIP                                              VARCHAR2(5)

SQL>
SQL>
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: