6

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!

1

1 Answer 1

5

You need to do

select * from function1();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.