I simply have a table that contains a list of countries and their ISO country codes. I\'m wrapping the query in a stored procedure (aka function) such as:
You should be able to use output parameters, like this:
CREATE OR REPLACE FUNCTION get_countries(country_code OUT text, country_name OUT text)
RETURNS setof record
AS $$ SELECT country_code, country_name FROM country_codes $$
LANGUAGE sql;