From: | "Postgres User" <postgres(dot)developer(at)gmail(dot)com> |
---|---|
To: | "eddy sanchez" <eddysan(at)udabol(dot)edu(dot)bo>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Add items to a record variable |
Date: | 2007-03-02 04:48:00 |
Message-ID: | b88c3460703012048t38188c7fxb0722951f3b7168c@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
If you need to return a record to another function or client program,
you can always use this sytnax:
SELECT var_a::integer, var_b::integer, var_c::integer... etc
where var_a, var_b, etc and local variables that hold your calculated values.
You dont need to create a local record structure- select will do that
for you. The '::integer' will ensure that the values are typecast as
integers.
On 3/1/07, eddy sanchez <eddysan(at)udabol(dot)edu(dot)bo> wrote:
> WEBMAIL Server: UDABOLnet, Universidad de Aquino Bolivia
>
> Thank you for you help
>
> The item is a field, I need to return a record with double precision or integer
> fields.
>
> I need a function that can calculate some fields (integer numbers) that should
> be added to a record inside a loop, and the result, must seems like this:
>
> {234.00, 56434.78, 5556.89,....}
>
> Always, I call those functions with:
>
> select * from func_with_record() as (field1 integer, field2 integer, field3
> integer,....)
>
> Do you undestand?
>
> Thanks a lot for your interesting.
>
>
>
> -----------------------------------
>
> What is the new item? Is it a field?
>
> On 3/1/07, eddy sanchez <eddysan(at)udabol(dot)edu(dot)bo> wrote:
> WEBMAIL Server: UDABOLnet, Universidad de Aquino Bolivia
>
>
> Can anyone help me???
>
> I work with plpgsql and I need to add items to a record variable, with a for
> statement, something like this:
>
> declare
> v_rec record;
> begin
> for nn in (some_xpresion) loop
> ....
>
> v_rec = vrec + [new_item]; <--Here I need to add an item to record variable with
> each loop
> end loop lp;
>
> return v_rec;
> end;
>
>
> The result should be like {it1,it2,it3,i4,....}
>
> Please can you help me?
> Thanks a lot
>
> -------------------------------------------------
> Este email se envio mediante el servidor WEBMAIL de UDABOLnet
> -------------------------------------------------
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>
>
> -------------------------------------------------
> Este email se envio mediante el servidor WEBMAIL de UDABOLnet
> -------------------------------------------------
>
From | Date | Subject | |
---|---|---|---|
Next Message | Shiva Sarna | 2007-03-02 05:03:24 | Re: supporting 2000 simultaneous connections. |
Previous Message | Postgres User | 2007-03-02 03:39:01 | Re: Fun with Cursors- how to rewind a cursor |