What is the best way to do table-level validation on column values ?
Database procedures called from database triggers are often a better way to do table-level validation on column values than using check constraints. You can easily perform most validation with a check constraint because it can use a database function as part of its SQL expression. However, check constraints are not a normal place to look for code; if someone tries to determine where validation is firing for a column, she or he may not find that code easily. In addition, you can do operations in a procedure that might not be possible with a function that has SQL restrictions. For example, writing a record to an audit table if validation failed is straightforward in a database procedure called by a trigger but may not be possible using a function in a check constraint.