Session Ready
Exercise

Creating named functions and declaring variables

Now that you've seen a powerful debugging function in action, let's build one of your own. First, start by using defining the function signature which supplied the function name, any parameters, and a return type. After that point, it's the same as a DO function.

Instructions
100 XP
  • Define a function named debug_statement that takes a SQL statement as sql_stmt.
  • The return type of the function should be a BOOLEAN.
  • The function should execute the supplied SQL statement and catch any exception.
  • The function should return True if it triggers debugging and False if it does not.