Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f4EJTBA46881 for ; Mon, 14 May 2001 15:29:11 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from ns1.saraf.net (ns1.saraf.com [207.226.147.228]) by postgresql.org (8.11.3/8.11.1) with SMTP id f4EIeQA27920 for ; Mon, 14 May 2001 14:40:26 -0400 (EDT) (envelope-from rvutukur@saraf.com) Received: (qmail 23567 invoked from network); 14 May 2001 18:40:53 -0000 Received: from unknown (HELO ireland) (63.217.189.119) by ns1.saraf.net with SMTP; 14 May 2001 18:40:53 -0000 Message-ID: <001c01c0dcad$de53f130$77bdd93f@saraf.com> From: "Radhika Vutukuru" To: Subject: working with stored procedures Date: Mon, 14 May 2001 14:41:28 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0019_01C0DC83.F551A910" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Archive-Number: 200105/130 X-Sequence-Number: 2946 This is a multi-part message in MIME format. ------=_NextPart_000_0019_01C0DC83.F551A910 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi , I am trying to create a stored procedure that returns a user defined type. = The following piece of code shows the way I am trying to do it. regy1=3D> create function regyuser_rec(int) returns varchar as ' declare regy1'> v_userid alias for $1; regy1'> output_rec varchar(400); regy1'> user_rec record; regy1'>=20 regy1'> begin regy1'>=20 regy1'> select fname ,lname into user_rec from regyuser regy1'> where userid =3D v_userid; regy1'> output_rec :=3D user_rec; regy1'> return output_rec; regy1'> end; regy1'> ' language 'plpgsql'; CREATE regy1=3D> select regyuser_rec(2); ERROR: Attribute 'user_rec' not found Does a postgresql function returns a user defined object? If so, could I have an example. I am new to postgresql, and was trying to figure out what's wrong with my c= ode.Could some one help me. Thanks, Radhika. ------=_NextPart_000_0019_01C0DC83.F551A910 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi ,
I am trying to create a stored procedure t= hat=20 returns a user defined type. The following piece of code shows the way I am= =20 trying to do it.
regy1=3D> create function regyuser_rec(= int)=20 returns varchar as ' declare
regy1'> v_userid alias for $1;
regy1'= >=20 output_rec varchar(400);
regy1'> user_rec record;
regy1'>=20
regy1'> begin
regy1'>
regy1'> select fname ,lname into= =20 user_rec from regyuser
regy1'>  where userid =3D=20 v_userid;
regy1'> output_rec :=3D user_rec;
regy1'> return=20 output_rec;
regy1'> end;
regy1'> ' language=20 'plpgsql';
CREATE
regy1=3D> select regyuser_rec(2);
ERROR: = ;=20 Attribute 'user_rec' not found
 
Does a postgresql function returns a user = defined=20 object?
If so, could I have an example.
I am new to postgresql, and was trying to = figure=20 out what's wrong with my code.Could some one help me.
Thanks,
Radhika.
------=_NextPart_000_0019_01C0DC83.F551A910--