0
0
PostgreSQLquery~10 mins

RAISE for notices and exceptions in PostgreSQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
AEXCEPTION
BWARNING
CNOTICE
DINFO
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.
2fill in blank
medium

Complete 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'
ANOTICE
BLOG
CWARNING
DEXCEPTION
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.
3fill in blank
hard

Fix 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'
AWARNING
BWARN
CEXCEPTION
DNOTICE
Attempts:
3 left
💡 Hint
Common Mistakes
Using WARN instead of WARNING causes syntax error.
Using EXCEPTION raises an error, not a warning.
4fill in blank
hard

Fill 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'
ANOTICE
BEXCEPTION
Cmy_var
D42
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.
5fill in blank
hard

Fill 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'
ANOTICE
Berror_code
Cerror_message
DEXCEPTION
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOTICE instead of EXCEPTION does not stop execution.
Swapping variable order changes the message meaning.