Oracle SQL Plus The Definitive Guide- P24B:Every day, computer professionals the world over wake up, travel to the office, sit down in front of a computer, and begin another day working with that database called Oracle. Programmers write queries and stored procedures. Database administrators monitor performance, make database changes, and perform other maintenance tasks. Operations people may need to back up or recover a database. | previous page page_206 next page previous page page_207 next page Page 207 PROJHOURSFKTOEMPLOYEE ENABLED FOREIGN KEY TO EMPLOYEEID PROJ_HOURS_FKTO_PROJECT ENABLED FOREIGN KEY TO PROJECTID EMPLOYEEID PROJECTID HOURS_LOGGED_MUST_BE_INT CHECK ENABLED hours_logged trunc hours_logged Indexes Two views return information about indexes. Each index gets an entry in the ALL_INDEXES view and the ALL_IND_COLUMNS view returns the columns included in each index. Listing Indexes for a Table The problem of listing indexes for a table is much the same as that of listing constraints on a table. You have a masterdetail relationship between the index and its columns and you may have multiple indexes on one table. There are two approaches you can take. One approach is to write a script that describes one particular index while the other is to write a script that lists all indexes on a table. The tradeoff between these two approaches is that one lets you look at indexes by name while the other lets you look at indexes by table. The problem is that you probably need both ways. Sometimes as when a unique index is violated you do need to look up an index by name. Other times you just want to see what indexes have been defined on a particular table. One thing to keep in mind when working with unique indexes is that Oracle will report a unique index violation as if it were a constraint violation. The error message you get is the same as the one used when you violate a unique constraint and it looks like this ORA-00001 unique constraint violated The reason for this is no doubt because Oracle enforces both unique and primary key constraints by creating indexes on the constrained fields. If you do get the error message just shown there are two things you might want to check. First list the constraints on the table you are updating. If you don t find one with a name that matches the one in the error message check to see if there happens to be