473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

return resultset

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
3 2515
rski
700 Expert 512MB
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
Well, I am using ParAccel which supports pgsql.
Apr 19 '10 #3
rski
700 Expert 512MB
It doesn't matter, the answer is use "return setof"
Apr 20 '10 #4

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

Similar topics

0
by: Craig Putnam | last post by:
This function: function queryDataConnection($query) { return mysql_query($query) or die("Oops"); } doesn't seem to properly return the result set, since this script: $resultSet =...
0
by: RoyalScorpion | last post by:
hi guys, i get an updatable resultset from a connection then used it to insert a new row but the result set doesn't chane after insertion, i mean the no of rows before insertion is the same after...
7
by: Gandalf | last post by:
Hi all, I am connecting to DB2 8.1 on Solaris through JDBC type 4 drivers (driver: com.ibm.db2.jcc.DB2Driver). Problem is that when a cursored query is done, the resultset gets closed after...
1
by: Neumann Péter | last post by:
Hi Every1, I'm fairly new to Postgres and ran into a problem quite soon. Until now I used MS Sql2000 and with it I was able to write a simple stored procedure that returned a resultset (for...
0
by: David Linsin | last post by:
I created a simple test case to reproduce the problem (also check Bug #15500): import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement;...
5
by: Fir5tSight | last post by:
Hi All, I have a C#.NET code as follows: private void ScanInput_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { try { Row lRow = this.Connection.InsertScannedFile(ID);
4
by: Mick Walker | last post by:
Hi Everyone, I am stumped here. I have the following stored proceedure:P CREATE PROCEDURE . @SupplierSKU varchar(50), @RetVal int AS Select @Retval = count(*) from dbo.ImportLines Where =...
13
by: ajos | last post by:
hi frnds, im doing some db related operations in my web project,im using mysql 5.0,i have the following piece of code in my action class- for(resultset =...
0
by: Dayzz | last post by:
http://www.thescripts.com/forum/thread710917.html. Closing thread - Moderator] Hi Everyone I have a code in VB that calls a Dynamic store procedure in MySQL DB, when I execute this store...
5
by: lost1 | last post by:
I am having trouble adding a result set to a scroll pane. no matter what I do using getText I get an error. Can someon give me a clue? import java.util.*; import java.sql.*; import java.awt.*;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.