Is it possible to assign a column name to a variable and then use that
variable in a SELECT statement inside a function using plpgsql?
For example:
CREATE OR REPLACE FUNCTION function_name("varchar")
RETURNS varchar AS
$BODY$
DECLARE
column_name alias for $1;
status varchar;
BEGIN
SELECT column_name INTO status FROM contact_table WHERE id = 1;
RETURN status;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
Thanks,
Derrick