By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,044 Members | 1,291 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,044 IT Pros & Developers. It's quick & easy.

return resultset

P: 2
Hi,

I am trying to return a resultset from a function and not sure how to do it but below is the function I created.

create or replace function sp_servicer_piechart_testing()
returns varchar
as
$$
select top 10 * from data where r='xxx'
$$
language sql immutable;

when executing it getting the below error:
Final SELECT must return exactly one column.

Can some one help me?

thanks.
Apr 16 '10 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 700
I guess you are looking for
Expand|Select|Wrap|Line Numbers
  1. return setof <type>
  2.  
see here http://www.postgresql.org/docs/8.4/s...xfunc-sql.html

Which postgres do you use, I don't think there is a top clause in select statements in postgres (it is in mssql).
Apr 16 '10 #2

P: 2
Well, I am using ParAccel which supports pgsql.
Apr 19 '10 #3

Expert 100+
P: 700
It doesn't matter, the answer is use "return setof"
Apr 20 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.