Passing column names dynamically for a record variable in PostgreSQL
Using PostgreSQL, column values from a table for 1st record are stored in a record variable. for ex: let the variable be: recordvar recordvar.columnname gives the value of the column name specified. I will define the columname in a variable: var := columnname In place of columnname if I replace with the variable i.e. recordvar.var , it is not working. Please let me know how to proceed in this situation. Following is the sample code: CREATE OR REPLACE FUNCTION getrowdata(id numeric, table_name character varying) RETURNS SETOF void AS $BODY$ DECLARE srowdata record; reqfield character varying;