Re: PLSQL function calling another function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: cyw(at)dls(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PLSQL function calling another function
Date: 2008-10-09 16:08:07
Message-ID: 16879.1223568487@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

<cyw(at)dls(dot)net> writes:
> I am trying to figure out how to call one PLSQL function from another, specifically how to access the return values from the callee.

> I made two test functions, A and B. A calls B.

> B returns two values:
> OUT tid integer
> OUT msg character varying

> In caller function A, I do the following:
> SELECT B(1) INTO rec; -- rec declared as a RECORD

This produces a record containing a single composite column (named "b"),
as you would see if you did the same SELECT by hand:

regression=# select b(1);
b
-----------
(100,MSG)
(1 row)

You will get the results you expect if you do something like

select * into rec from b(1);

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Carol Walter 2008-10-09 17:40:25 errors in gmake...
Previous Message Brad Nicholson 2008-10-09 15:06:02 Re: checkpoint_timeout

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2008-10-09 16:26:41 Re: Re: [Pkg-postgresql-public] Postgres major version support policy on Debian
Previous Message Jeff Ross 2008-10-09 14:26:44 Re: databases list to file