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 E1F929DCB52 for ; Wed, 7 Dec 2005 15:36:56 -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 57064-04 for ; Wed, 7 Dec 2005 15:36:56 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.205]) by postgresql.org (Postfix) with ESMTP id 5408B9DCAA6 for ; Wed, 7 Dec 2005 15:36:54 -0400 (AST) Received: by xproxy.gmail.com with SMTP id s14so301700wxc for ; Wed, 07 Dec 2005 11:36:55 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=NvGNV+7naMSbnPvV7Ddviiumrxlr1lPZvRUl0+P5mEtW3G41iD7G5hE6VzvJLpLBE7iRarzf9lOeM92qcgnxeSTRyuxng/0CynYuvDyXYJfXv+RkkaFCSDcRAcbagD6Bg5T27tp/PJFbja4OfYpTPvfTsAVCGZv/E/kqfPgveSI= Received: by 10.70.79.11 with SMTP id c11mr2580717wxb; Wed, 07 Dec 2005 11:36:55 -0800 (PST) Received: by 10.70.48.10 with HTTP; Wed, 7 Dec 2005 11:36:55 -0800 (PST) Message-ID: <1319fbba0512071136q212dfedag10aad63af0ad152@mail.gmail.com> Date: Wed, 7 Dec 2005 11:36:55 -0800 From: Aaron Koning To: =?ISO-8859-1?Q?Alexandre_Gon=E7alves_Jacarand=E1?= Subject: Re: Help on function creating Cc: pgsql In-Reply-To: <4396D50D.5060407@yahoo.com.br> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4191_31307087.1133984215368" References: <4396D50D.5060407@yahoo.com.br> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[HTML_MESSAGE=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/60 X-Sequence-Number: 23602 ------=_Part_4191_31307087.1133984215368 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Have you considered using a view to create the report? Aaron On 12/7/05, Alexandre Gon=E7alves Jacarand=E1 wrote= : > > 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=E7alves Jacarand=E1 > Assessor de Tecnologia de Informa=E7=E3o > Tel.: 0 ** 21 8131-2313 > > > > > > > > _______________________________________________________ > Yahoo! doce lar. Fa=E7a do Yahoo! sua homepage. > http://br.yahoo.com/homepageset.html > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq > ------=_Part_4191_31307087.1133984215368 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Have you considered using a view to create the report?

Aaron

On 12/7/05, Alexandre Gon=E7alves Jacarand=E1 <clark_vr@yahoo.com.br> wrote: Hello everyone, I'm using postgresql form an year and I have some
diffic= ult 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 &quo= t; public.matricula"
         Column          | &n= bsp;         Type           |    Modifiers

-------------------------+-------= -------------------+-------------------------------------------------
id            &= nbsp;         | integer           &n= bsp;      | not null default
nextval('seq_matricula'::text)
ref_contrato          &nb= sp; | integer           &n= bsp;      |
ref_pessoa           = ;   | integer           &n= bsp;      |
ref_campus           = ;   | integer           &n= bsp;      |
ref_curso           =     | integer           &n= bsp;      |
ref_periodo          &nbs= p;  | character varying(10)    |
ref_disciplina          | integer           &n= bsp;      |
ref_curso_subst         | integer           &n= bsp;      |
ref_disciplina_subst    | integer           &n= bsp;      |
ref_disciplina_ofer     | integer           &n= bsp;      |
nota            = ;        | double precision         | default 0
nota_exame           = ;   | double precision         | default 0
nota_final           = ;   | double precision         | default 0
conceito           &= nbsp;    | character varying(5)     | default
''::character var= ying
conceito_exame          | character varying(5)     | default
''::character var= ying
conceito_final          | character varying(5)     | default
''::character var= ying

I need to have an output like:
ref_pessoa | ref_disciplina1&= nbsp; | ref_disciplina2 | ... | ref_disciplina n
1   = ;       |  nota_final1 &n= bsp;   | nota_final2      | ... | nota_final n
How can I make this ? I know  that I need to declare an variabl= e 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 ca= minho pela reta.

Alexandre Gon=E7alves Jacarand=E1
Assessor de Te= cnologia de Informa=E7=E3o
Tel.: 0 ** 21 8131-2313






_______________________________________________________
Yahoo! doce = lar. Fa=E7a do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html


----------= -----------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

   &nb= sp;           http://www.postgresql.org/docs/faq<= br>

------=_Part_4191_31307087.1133984215368--