galdor, There are reasons to avoid putting too much business logic in the database with user-defined functions, but the most bizarre reason I've seen is that they are hard to test. Your application can execute SQL queries, but somehow you cannot execute one in tests?