 |
|
ss
Oracle Tips by Burleson |
Protection vs. Validation
Through out this section, I have talked
about constraints protecting your data. The job of the constraint
is to insure that the data you INSERT/UPDATE meets the requirements
set forth in the constraints, to protect your data. Many users use
constraints to validate their data. Basically, here is a row, throw
it at the database and see if it accepts it.
While this approach works, it has a
significant impact on the database performance. The Oracle database
assumes that the data will be accepted. The database logs the
changes in the undo/redo logs, updates the table (and any indexes)
before checking the constraints. If the data fails, all those
changes must be undone.
Why does the database implement constraint
checking in this way? Because, it is the most efficient way for the
database to store and protect your data. Your application is
responsible for validating the data. The database catches those
pieces of data that the program let slip through, thus providing
integrity protection.
Always validate your data in your
application. Database constraints are there to protect your data.
Now that we can insure the quality of our
data by implementing constraints, we need to look at some of the
database objects that allow us to better access that data.
The above book excerpt is from:
Easy Oracle
SQL
Get Started
Fast writing SQL Reports with SQL*Plus
ISBN 0-9727513-7-8
John Garmany
http://www.rampant-books.com/book_2005_1_easy_sql.htm |