Session Ready
Exercise

Capturing specific exceptions

Let's build a DO function that captures when glucose is set to null, and logs a message stating explicitly that Glucose can not be null.

Instructions
100 XP
  • Inside of the BEGIN block of the DO function, INSERT into patients the row (a1c=7.5, glucose=null, and fasting= TRUE).
  • Add a not_null_violation exception that inserts "Glucose can not be null." in the detail column of errors in case of an error.