473,387 Members | 1,899 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,387 software developers and data experts.

I'm writing a function which uses cursor and I have an error when executing it

when executing the function as follow:
select get_pms_meeting_minute (null)

I get the follwing message:
set-valued function called in context that cannot accept a set

Expand|Select|Wrap|Line Numbers
  1.  
  2. CREATE TABLE pms_meeting_minutes
  3. (
  4.   id_meeting_minutes integer NOT NULL,
  5.   location character varying(50),
  6.   date_meeting date,
  7.   time_meeting time without time zone,
  8.   responsible integer,
  9.   name_meeting_minute character varying(50),
  10.   CONSTRAINT pk_pms_meeting_minutes PRIMARY KEY (id_meeting_minutes));
  11.  
  12.  
  13. create function get_pms_meeting_minute (integer) RETURNS SETOF RECORD AS'
  14.  
  15. DECLARE 
  16.     ret_row RECORD;    
  17.  
  18. BEGIN
  19.     IF $1 IS NULL THEN
  20.       FOR ret_row IN SELECT *
  21.                      FROM pms_meeting_minutes
  22.       LOOP
  23.         RETURN NEXT ret_row;
  24.       END LOOP;
  25.  
  26.     ELSE
  27.        IF $1 IS NOT NULL THEN
  28.          FOR ret_row IN SELECT  * 
  29.                         FROM pms_meeting_minutes
  30.                         WHERE id_meeting_minutes = $1
  31.          LOOP
  32.            RETURN QUERY;
  33.          END LOOP;  
  34.        END IF;
  35.     END IF;
  36. END;'
  37.  
  38. LANGUAGE 'plpgsql'; 
  39.  
Sep 7 '10 #1

✓ answered by rski

Maybe try calling it like that
Expand|Select|Wrap|Line Numbers
  1. select * from get_pms_meeting_minute (null);
  2.  

2 2311
rski
700 Expert 512MB
Maybe try calling it like that
Expand|Select|Wrap|Line Numbers
  1. select * from get_pms_meeting_minute (null);
  2.  
Sep 13 '10 #2
thanks a lot
it works now.
Sep 14 '10 #3

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

Similar topics

2
by: ColinWard | last post by:
whenever I run the following code I get an error saying that 'Trade Show and Conference Contacts database could not find the form 'Events_Form' referred to in a macro or in Visual Basic Code. The...
2
by: Pascal Polleunus | last post by:
(another try with a different subject as it doesn't seem to work with "EXECUTE + transaction = unexpected error -8" :-/) Hi, It seems that there is a problem when executing a dynamic...
1
by: bhavin30 | last post by:
Hi Guys, I have a quick question. I think code will explain it the best. This is what I am doing for one of the columns during databinding on my grid: <asp:TemplateColumn> <HeaderStyle...
5
by: Jose Cintron | last post by:
I created a pretty basic program based on the "Windows Forms Application" template using C++ in VS 2005. When I run the program from my local system it runs properly (do happy dance), now when I...
3
by: Goog79 | last post by:
Hi everyone, first time here, so I'm sorry if this has been covered already ages ago. :( I am trying to learn T-SQL and Stored Procedures and bought the book on these topics by Djan...
2
by: psbasha | last post by:
Hi , I am getting the following error in ActiveState ActivePython2.4,when executing the UI which I worked in Python2.4.2 downloaded from www.Python.org ...
1
by: tgorton | last post by:
I am having a problem running a javascript function as part of an html-el:form onsubmit. The problem seems to exists in IE6 but not in Firefox. html: <html-el:form action="${target}"...
4
by: getmeidea | last post by:
Hi all, I have run a batch file contains, mysql -uroot -proot -Dsample_db < "create_sp.sql" The "create_sp.sql" file contains definition for the stored procedure by the name...
4
by: James Lucero | last post by:
Below is my code. The error is "Compile Error Variable not defined". wdOrientLandscape is highlighted. Again this the portion of the code from a VB module created in Excel. The previous lines of code...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.