pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: cyw@dls.net
Cc: pgsql-general@postgresql.org
Subject: Re: PLSQL function calling another function
Date: Thu, 09 Oct 2008 12:08:07 -0400
Message-ID: <16879.1223568487@sss.pgh.pa.us> (raw)
In-Reply-To: <092C17F5803E42FCAFD8D3A43A2E5A12@nc05072019>
References: <d8e7a1e30810090623i7766fc50xb46fc3e5efa3836@mail.gmail.com>
	<092C17F5803E42FCAFD8D3A43A2E5A12@nc05072019>

<cyw@dls.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



view thread (2+ messages)

Message-ID: <16879.1223568487@sss.pgh.pa.us>
Permalink:  ../16879.1223568487@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/16879.1223568487@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, cyw@dls.net, pgsql-general@postgresql.org
  Subject: Re: PLSQL function calling another function
  In-Reply-To: <16879.1223568487@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox