pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Postgres Equivalent of Oracle Package
Date: Wed, 17 Nov 2021 22:45:40 -0500
Message-ID: <87b2142e-276f-bf53-a8e0-f9a84aa9677d@gmail.com> (raw)
In-Reply-To: <826773243.402693.1637083393436@connect.xfinity.com>
References: <CAMBRECD14zp50Ex3E8L2MtZPHGAsSVX3zDo57=e_ov7fM8ONSA@mail.gmail.com>
	<494df2a3-5201-33c6-d973-0e7baa09bb20@rodonnell.ie>
	<826773243.402693.1637083393436@connect.xfinity.com>


On 11/16/21 12:23, DAVID ROTH wrote:
> One of the nice things about Oracle packages is that the code is loaded and global values are set and stored only once per session. This is very useful for values that are used repeatedly.
>
> What is the best way of emulating this behavior in Postgresql?
>
>

You can create a temporary table with "ON COMMIT PRESERVE ROWS", which 
is visible in a session and cannot cross the session boundary.  Values 
in the table can be queried throughout the session. That is a pretty 
good approximation of the session variables in Oracle.

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com






view thread (5+ messages)

Message-ID: <87b2142e-276f-bf53-a8e0-f9a84aa9677d@gmail.com>
Permalink:  ../87b2142e-276f-bf53-a8e0-f9a84aa9677d@gmail.com/
Also on:    postgresql.org/message-id/87b2142e-276f-bf53-a8e0-f9a84aa9677d@gmail.com

 · 

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 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: gogala.mladen@gmail.com
  Subject: Re: Postgres Equivalent of Oracle Package
  In-Reply-To: <87b2142e-276f-bf53-a8e0-f9a84aa9677d@gmail.com>
  References: <CAMBRECD14zp50Ex3E8L2MtZPHGAsSVX3zDo57=e_ov7fM8ONSA@mail.gmail.com> <494df2a3-5201-33c6-d973-0e7baa09bb20@rodonnell.ie> <826773243.402693.1637083393436@connect.xfinity.com> <87b2142e-276f-bf53-a8e0-f9a84aa9677d@gmail.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