"storing" a calculated value in plsql function ? - Mailing list pgsql-general

From stan
Subject "storing" a calculated value in plsql function ?
Date
Msg-id 20190830104801.GA15055@panix.com
Whole thread Raw
Responses Re: "storing" a calculated value in plsql function ?
Re: "storing" a calculated value in plsql function ?
List pgsql-general
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



pgsql-general by date:

Previous
From: Luca Ferrari
Date:
Subject: Re: Regarding db dump with Fc taking very long time to completion
Next
From: Luca Ferrari
Date:
Subject: Re: "storing" a calculated value in plsql function ?