From: | "Thalis A(dot) Kalfigopoulos" <thalis(at)cs(dot)pitt(dot)edu> |
---|---|
To: | Alla <alla(at)sergey(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Please help! Functions passing records between them |
Date: | 2001-06-12 20:55:56 |
Message-ID: | Pine.LNX.4.21.0106121654010.19889-100000@aluminum.cs.pitt.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
I had asked something simular a week back.
This should help you :-)
http://fts.postgresql.org/db/mw/msg.html?mid=121203
cheers,
thalis
ps did someone play too much with the majordomo? it screwes up the list addresses in Cc: when I reply to a message
On 12 Jun 2001, Alla wrote:
> Guys;
>
> I am begging for your help again.
>
> I can't find a solution to my problem.
>
> I am porting a complex system from Oracle to PostgreSQL and I need to
> implement the following:
>
> function 1 does some processing and returns a record (I can declare it
> as a row in a view)
> function 2 uses func1 to get that record and does some more processing
>
> My problem is that even if I can return a record from my function 1,
> function 2 does not read it properly
>
> Here is an example:
> create view my_view
> as select null as type, null as value, null as timestamp; -- this
> is how I "declare" the user-defined data structure (I could not find
> any other way)
>
> create function func1()
> returns my_view as '
> declare
> my_record my_view%rowtype;
> begin
> .....
> .....
> my_record.type := ''AAA'';
> my_record.value := 25;
> my_record.timestamp := now(); -- this is for simplicity
>
> return my_record;
> end;
> ' LANGUAGE 'plpgsql';
>
> create function func2()
> returns varchar as '
> declare
> my_record my_view%rowtype;
> begin
> select func1() into my_record;
>
> return my_record.type;
> end;
> ' LANGUAGE 'plpgsql';
>
>
> It compiles and runs fine, except that it does not return what it's
> supposed to. It gives me some strange huge number, which I assume is
> some kind of OID
>
>
> I know that there are quite a few gurus of PostgreSQL out there -
> please help me solve this problem. May be my whole approach is wrong,
> but I need to be able to accomplist this: pass some kind of
> user-defined structures between function
>
> Thank you so much for your help
>
> Alla Gribov
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: 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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Thalis A. Kalfigopoulos | 2001-06-12 20:57:35 | Re: Adding a primary key |
Previous Message | Arcady Genkin | 2001-06-12 20:42:31 | PHP's pg_connect() and non-standard location of the socket (was: REPOST: redefining location of the socket file /tmp/.s.PGSQL.5432) |
From | Date | Subject | |
---|---|---|---|
Next Message | Philip Hallstrom | 2001-06-12 21:04:49 | Re: Bit Mapping operation |
Previous Message | Thalis A. Kalfigopoulos | 2001-06-12 20:42:05 | Re: Function returning record |