3

I want create select function in postgres and get all data from table. I many example see and try but not perfact execute function. What perfact syntax for select query function create in postgres?

My function code.

 CREATE OR REPLACE FUNCTION dataget()
 RETURNS SETOF tbuserlogin AS
$BODY$BEGIN
RETURN QUERY SELECT * FROM tbuserlogin;
END$BODY$
 LANGUAGE plpgsql VOLATILE
 COST 100
 ROWS 1000;
ALTER FUNCTION dataget()
 OWNER TO postgres;

This function execute and show the datatable record but this display record not proper column wise but only one function column display. Like this

Thanks. enter image description here

asked Jan 23, 2014 at 8:32
1
  • 2
    Is this homework? That function is malformed in such a contrived way that it seems like it must've been done on purpose. Commented Jan 23, 2014 at 8:51

1 Answer 1

2

Function Execute like this And get my Answer

select * from functionname();
answered Jan 23, 2014 at 11:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.