Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Syntax of PL/pgSQL
Function parameters
Handling exceptions
Summary

Instruction

Great! You can display a message with arguments. In the string with the message, simply use the % character as many times as you need. Then, after a comma, list all the variables (arguments) you'd like to print.

For example, a function that displays a message passed as an argument may look like this:

CREATE FUNCTION show_message(message varchar)
RETURNS void AS $$
BEGIN
  RAISE NOTICE 'The show_message() function was called with the argument: %', message;
END;
$$ LANGUAGE plpgsql;

Exercise

Write the function hello() that takes one argument name of type varchar and displays the notice 'Hello, ' followed by the name provided as the argument.

For example hello('Roman') should display:

Hello, Roman

The function should return void.