X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BE26D476182 for ; Sun, 23 Mar 2003 18:18:27 -0500 (EST) Received: from ozimelb03.ozicom.com (unknown [203.185.247.100]) by postgresql.org (Postfix) with ESMTP id BB01A47610C for ; Sun, 23 Mar 2003 18:18:26 -0500 (EST) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: Re: FUNCTIONS PROBLEM X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Date: Mon, 24 Mar 2003 10:18:27 +1100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] FUNCTIONS PROBLEM Thread-Index: AcLv4esIvU+WCD+jQBa3KIe2av3ukwBrmgQA From: "David Witham" To: "Mario Alberto Soto Cordones" , X-Spam-Status: No, hits=1.1 required=5.0 tests=SUBJ_ALL_CAPS version=2.50-cvs X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 2.50-cvs (1.172-2003-02-14-exp) X-Archive-Number: 200303/533 X-Sequence-Number: 12572 Hi Mario, I have used a record type to do this: create myfunc() returns record as ' declare return_val record; col1 int; col2 int; col3 real; col4 char; col1 :=3D 5; col2 :=3D 10; col3 :=3D 2.7; col4 :=3D ''z''; select col1,col2,col3,col4 into return_val; return return_val; end; ' language 'plpgsql'; When you call the function you need to specify the expected output: select * from myfunc() as (val1 int, val2 int, val3 real, val4 char); See the SELECT reference page in the documentation. There are other ways (which may be better) to do this that don't require th= e output types to be specified with the query but this is the one I got goi= ng first so I stuck with it. Hope this helps. Regards, David Witham Telephony Platforms Architect Unidial -----Original Message----- From: Mario Alberto Soto Cordones [mailto:mario_soto@compuall.cl] Sent: Friday, 21 March 2003 09:26 To: pgsql-sql@postgresql.org Subject: [SQL] FUNCTIONS PROBLEM Importance: High Hi. i have a function and i need to return 4 fields but not work, any idea , please thank mario ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster