I think you’re looking for SELECT select_expressions INTO
:
select test_table.name into name from test_table where id = x;
That will pull the name
from test_table
where id
is your function’s argument and leave it in the name
variable. Don’t leave out the table name prefix on test_table.name
or you’ll get complaints about an ambiguous reference.