Chapter 6. Exploring Your Database
You can create a variety of different objects in an Oracle database. You can create tables, indexes on those tables, objects, constraints, and so forth. It’s important to be able to get information about the objects you have created. After a while you are going to find yourself asking questions like: “What tables do I have defined?” and “What do they look like?” You may have an application fail because of a constraint violation. In order to understand why the error occurred, you need to know what the definition is for that constraint. Unless you have an extremely good memory, you will need to go to the database itself for this information.
Using SQL*Plus, there are two ways you can display information about objects within your database. The easiest way is to use the DESCRIBE command. DESCRIBE will tell you about columns in a table or view. DESCRIBE will also show you the definition of an object type or of a PL/SQL package. The second method for getting information about objects in your database is to query the Oracle data dictionary. The data dictionary is a set of tables Oracle uses to keep track of object definitions. To facilitate your use of the data dictionary, Oracle provides a set of views known as data dictionary views. This chapter will show you how some of these views work and how you can write scripts to query them.
The DESCRIBE Command
You may already be familiar with the SQL*Plus DESCRIBE command. DESCRIBE may be used to get a list ...