X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 4AE379DCAD1 for ; Wed, 7 Dec 2005 08:28:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23441-06 for ; Wed, 7 Dec 2005 08:28:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp201.mail.sc5.yahoo.com (smtp201.mail.sc5.yahoo.com [216.136.129.91]) by postgresql.org (Postfix) with SMTP id BA79E9DCABF for ; Wed, 7 Dec 2005 08:28:18 -0400 (AST) Received: (qmail 42567 invoked from network); 7 Dec 2005 12:28:12 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=WGmI1gyCSRssEh2ik33Co7KgXDJ3X7hNmU5PbQw2b4scztbDIck7/olwl6D+Rf16xXO/q8t/4XBubXqtmb0rci//o/R7KN2zgSY3xDqC72R80wLAdvm6X0BYYsxmg9Ba/udbpUS52T3XzNSZZuHZPwkbi3n56gA9AejMcD6jgYw= ; Received: from unknown (HELO ?200.164.134.101?) (clark?vr@200.164.134.101 with plain) by smtp201.mail.sc5.yahoo.com with SMTP; 7 Dec 2005 12:28:06 -0000 Message-ID: <4396D50D.5060407@yahoo.com.br> Date: Wed, 07 Dec 2005 10:26:53 -0200 From: =?ISO-8859-1?Q?Alexandre_Gon=E7alves_Jacarand=E1?= User-Agent: Mozilla Thunderbird 1.0.6-7.1.20060mdk (X11/20050322) X-Accept-Language: pt-br, pt MIME-Version: 1.0 To: pgsql Subject: Help on function creating Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.643 required=5 tests=[AWL=-0.164, DNS_FROM_RFC_ABUSE=0.479, RCVD_IN_NJABL_PROXY=0.327] X-Spam-Score: 0.643 X-Spam-Level: X-Archive-Number: 200512/54 X-Sequence-Number: 23596 Hello everyone, I'm using postgresql form an year and I have some difficult to write a function to make an report. I'm running PostgreSQL 7.5.3 on i686-pc-linux-gnu (Mandriva 10.1). My table structure is: Tabela "public.matricula" Column | Type | Modifiers -------------------------+--------------------------+------------------------------------------------- id | integer | not null default nextval('seq_matricula'::text) ref_contrato | integer | ref_pessoa | integer | ref_campus | integer | ref_curso | integer | ref_periodo | character varying(10) | ref_disciplina | integer | ref_curso_subst | integer | ref_disciplina_subst | integer | ref_disciplina_ofer | integer | nota | double precision | default 0 nota_exame | double precision | default 0 nota_final | double precision | default 0 conceito | character varying(5) | default ''::character varying conceito_exame | character varying(5) | default ''::character varying conceito_final | character varying(5) | default ''::character varying I need to have an output like: ref_pessoa | ref_disciplina1 | ref_disciplina2 | ... | ref_disciplina n 1 | nota_final1 | nota_final2 | ... | nota_final n How can I make this ? I know that I need to declare an variable an than make an for - loop, but I don't know how. Where can I get some examples for this? Thanks. -- __________________________ Alguns caminham pelo arco, eu caminho pela reta. Alexandre Gonçalves Jacarandá Assessor de Tecnologia de Informação Tel.: 0 ** 21 8131-2313 _______________________________________________________ Yahoo! doce lar. Faça do Yahoo! sua homepage. http://br.yahoo.com/homepageset.html