I have the below function:
CREATE OR REPLACE FUNCTION function1() RETURNS TABLE(foo1 VARCHAR, foo2 VARCHAR) AS $$
BEGIN
RETURN QUERY SELECT e.col1, e.col2 FROM my_table e;
END;
$$ LANGUAGE plpgsql;
It returns something like this:
function1
record
|--------------|
(a,b)
(c,d)
But I'm expecting a result analog to a query like this:
SELECT e.col1, e.col2 FROM my_table e;
col1 col2
|-----|-----|
a b
c d
Because I want to execute the function a get the separates columns values in a java resultSet and iterate accros them. Thanks!
You need to do
select * from function1();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With