Unix Technical Forum

out parameter and setof record

This is a discussion on out parameter and setof record within the Pgsql General forums, part of the PostgreSQL category; --> In PostgreSql 8.1 i've tried to use Out parameter but when I've changed function (added Out parameter) ------------------------------------ CREATE ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 09:59 AM
uran1@o2.pl
 
Posts: n/a
Default out parameter and setof record

In PostgreSql 8.1 i've tried to use Out parameter but when I've changed
function (added Out parameter)

------------------------------------

CREATE OR REPLACE FUNCTION reffunc3(FROM_ID in integer,COUNT_ROW OUT
integer) RETURNS SETOF Person AS '
DECLARE
rec RECORD;
BEGIN

SELECT count(*) INTO COUNT_ROW FROM Person WHERE ssn>FROM_ID ;

FOR rec IN SELECT ssn,name FROM Person WHERE ssn>FROM_ID
LOOP
c;RETURN NEXT rec ;
END LOOP ;

RETURN ;
END;
' LANGUAGE plpgsql;



--SELECT * from reffunc3(1) ;
----------------------------------------

i've seen :

----
ERROR: function result type must be integer because of OUT parameters
----

Of course when I change parameter to Integer it must be Record error
appears.

What should I change, and how to call this function?

Mirek

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 10:00 AM
A. Kretschmer
 
Posts: n/a
Default Re: out parameter and setof record

am 30.05.2006, um 3:21:27 -0700 mailte uran1@o2.pl folgendes:
> In PostgreSql 8.1 i've tried to use Out parameter but when I've changed
> function (added Out parameter)
> ...
> ----
> ERROR: function result type must be integer because of OUT parameters
> ----
>
> Of course when I change parameter to Integer it must be Record error
> appears.


A good explanation for IN/OUT-Parameters can you find there:
http://people.planetpostgresql.org/x....html#extended


HTH Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:38 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com