Chapter 10. Exploring Your Database

You can create various objects in an Oracle database. You can create tables, indexes on those tables, object types, constraints, and various other objects. 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 such as, "What tables do I have defined?" and "What do they look like?" You may have an application fail because of a constraint violation. To understand why the error occurred, you need to know what the definition is for that constraint. Unless you have a good memory, you will need to go to the database for this information.

Using SQL*Plus, you have two ways to 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 shows you how some of these views work and how you can write scripts to query them.

The DESCRIBE Command

You may be familiar with the SQL*Plus DESCRIBE command. You can use DESCRIBE to get a list of columns in a table or view, along with ...

Get Oracle SQL*Plus: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.