Can a session variable be set to the contents of a function parameter using SET SESSION? I'd like to set a session variable inside of a function, using the values passed into the function.

Example:

CREATE FUNCTION my_function(my_param INT)
RETURNS VOID AS $$
BEGIN
    SET SESSION "myapp.myvar" = my_param;
END 
$$
LANGUAGE plpgsql;

SELECT * FROM my_function(100);
SELECT current_setting('myapp.myvar');


What I get:

my_param


What I want:

100
Use set_config() 

CREATE FUNCTION my_function(my_param INT)
RETURNS VOID AS $$
BEGIN
    perform set_config('myapp.myvar', my_param::text, true);
END 
$$
LANGUAGE plpgsql;