Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using the SQL language on Postgres to return a table using the RETURNS TABLE command:

CREATE OR REPLACE FUNCTION procreadbudget()
  RETURNS TABLE(budgetmonth character, budgetincome numeric, budgetexpense numeric) AS
$BODY$
SELECT budget_month, budget_income, budget_expense FROM budget ORDER BY unique_id;
$BODY$
  LANGUAGE 'sql' VOLATILE

All the data is returned as a comma delimited string, not as a table:

"(Jan,1123,1201)"
"(Feb,1098,996)"
"(Mar,1545,1345)"
"(Apr,1564,1952)"
"(May,1123,990)"
"(Jun,1345,1234)"
"(Jul,1234,878)"
"(Aug,1139,1187)"
"(Sep,1076,1123)"
"(Oct,873,956)"
"(Nov,1298,1423)"
"(Dec,1123,1324)"

Any suggestions please, Mike

share|improve this question
 
So the question is, what do you expect it to return? –  Frank Bollack Jul 23 '10 at 8:50
add comment

2 Answers

Use

SELECT * FROM procreadbudget();

instead of

SELECT procreadbudget();
share|improve this answer
add comment

do like this:

select t.budgetmont,
       t.budgetincome,
       t.budgetexpense
from procreadbudget() as t
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.