The method I am using may not be efficient (or possible), if so please let me know.
I am trying to use SELECT INTO to select two values and then attach them to a variable (v1) which will be returned by the function as one cell. Inserting UNION ALL between the two SELECT INTO statements results in an ERROR: syntax error at or near "UNION"
EDIT - the function provides two unique values (not null) which are specified for these two SELECT INTO statements
desired output:
v1 v2 v3 etc.
2678, 2987
excerpt from function:
SELECT value
INTO v1
FROM table
WHERE year <= parameteryear;
SELECT value
INTO v1
FROM table
WHERE yearinteger >= parameteryear;
data := v1;
RETURN NEXT;
END;
$$ LANGUAGE plpgsql;
select intois used to create tables, not to assign values to variables. I am unclear on what you are trying to accomplish.select .. intois definitely used to put values into variables. postgresql.org/docs/current/static/…v1, as well as all parameters and the declared RETURN type. Also include a proper description of what you are trying to achieve with the function. To be certain we also need a table definition (\d tblin psql). Canvaluebe NULL in the table?