Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to raise a notice message in PostgreSQL.
PostgreSQL
RAISE [1] 'This is a notice message';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXCEPTION instead of NOTICE causes the code to stop with an error.
Using INFO raises an INFO message instead of NOTICE.
✗ Incorrect
The NOTICE level is used to send informational messages without stopping execution.
2fill in blank
mediumComplete the code to raise an exception with a custom error message.
PostgreSQL
RAISE [1] 'Custom error occurred';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOTICE or WARNING will not stop execution as expected.
Using LOG only logs the message but does not raise an error.
✗ Incorrect
The EXCEPTION level raises an error and stops the function or transaction.
3fill in blank
hardFix the error in the code to raise a warning message.
PostgreSQL
RAISE [1] 'This is a warning';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using WARN instead of WARNING causes syntax error.
Using EXCEPTION raises an error, not a warning.
✗ Incorrect
The correct keyword for warnings is WARNING. WARN is not valid.
4fill in blank
hardFill both blanks to raise a notice with a variable value.
PostgreSQL
RAISE [1] 'Value is: %', [2];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXCEPTION stops execution instead of showing a notice.
Passing a literal number instead of the variable loses dynamic value.
✗ Incorrect
Use NOTICE to raise a notice and pass the variable my_var as the argument.
5fill in blank
hardFill all three blanks to raise an exception with a formatted message including a variable.
PostgreSQL
RAISE [1] 'Error code %: %', [2], [3];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOTICE instead of EXCEPTION does not stop execution.
Swapping variable order changes the message meaning.
✗ Incorrect
Use EXCEPTION to raise an error. The placeholders % are replaced by error_code and error_message.