I'm creating this function that returns a table. I have this issue in the 9th line in the code below, I believe the 'position' and the following 'attribute' column is the main problem. I want to return the column name exactly like in the code below. Anyone can help me? Thanks in advance!
CREATE OR REPLACE FUNCTION acc_qry_chart_of_account (
type CHARACTER (3)='GL') RETURNS TABLE ( seqno SERIAL,
acc_id INTEGER,
parent_code CHARACTER (20),
acc_code CHARACTER (20),
description CHARACTER VARYING (120),
description2 CHARACTER VARYING (120),
acclevel INTEGER,
position CHARACTER VARYING (120),
attribute INTEGER,
acctype CHARACTER (3),
exttype CHARACTER(3)
)
AS $$
DECLARE
....
BEGIN
....
END;
$$ LANGUAGE 'plpgsql'
You can solve this way. 2 changes.
New function: