From: stan <stanb@panix.com>
To: pgsql-general@lists.postgresql.org
Subject: "storing" a calculated value in plsql function ?
Date: Fri, 30 Aug 2019 06:48:01 -0400
Message-ID: <20190830104801.GA15055@panix.com> (raw)
I have created a function (PLSQL) that does a complex select with joins on various
tables and views, and returns a table.
In the resultant table, I have raw data, and adjusted data. The adjusted data i
all adjusted by a common factor, which is calculated in the select. Presently, I
calculate this same adjustment factor several times in the select.
Is there a way to reference this value, multiple times, once it is calculated? Or
would I have to create a 2nd select that calculates this adjustment factor, and
stores it in a PLSQL variable< and if I do that, can I reference this stored value
in the select?
--
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
-- Benjamin Franklin
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: stanb@panix.com
Subject: Re: "storing" a calculated value in plsql function ?
In-Reply-To: <20190830104801.GA15055@panix.com>
References: <20190830104801.GA15055@panix.com>
* 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