Data Dictionary and Objects


Listing Objects

01SQL> SELECT  object_name, object_type  FROM  user_objects;
02 
03OBJECT_NAME                   OBJECT_TYPE
04------------------------      --------------------
05ACCOUNTS                      TABLE
06ACC_TYP                       TYPE
07ADDRESS                       TYPE
08ADDRESS_TAB                   TABLE
09ADDRESS_TYP                   TYPE
10CUSTOMER                      TABLE


Describing Object Type Attributes with the Data Dictionary
Use the SQL*Plus DESCRIBE command to display the attributes of a type.

SQL> DESC  address_typ; 

Name                    Null?    Type
----------------------- -------- ------------------
ADDRESS1                         VARCHAR2(32)
ADDRESS2                         VARCHAR2(32)
CITY                             VARCHAR2(16)
STATE                            CHAR(2)
ZIP                              CHAR(5)


Information about object type attributes can also be found in the data dictionary tables: ALL_TYPE_ATTRS and USER_TYPE_ATTRS.

01SQL> DESC  user_type_attrs;
02 
03Name                         Null?    Type
04---------------------------- -------- -----------------------
05TYPE_NAME                    NOT NULL VARCHAR2(30)
06ATTR_NAME                    NOT NULL VARCHAR2(30)
07ATTR_TYPE_MOD                         VARCHAR2(7)
08ATTR_TYPE_OWNER                       VARCHAR2(30)
09ATTR_TYPE_NAME                        VARCHAR2(30)
10LENGTH                                NUMBER
11PRECISION                             NUMBER
12SCALE                                 NUMBER
13CHARACTER_SET_NAME                    VARCHAR2(44)
14ATTR_NO                      NOT NULL NUMBER
15INHERITED                             VARCHAR2(3)





      I feel bad for the homeless guy,    
      but I feel really bad for the homeless guy’s dog,    
      because he must be thinking    
      “Man, this is the longest walk ever.”