pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Postgres Equivalent of Oracle Package
5+ messages / 3 participants
[nested] [flat]

* Postgres Equivalent of Oracle Package
@ 2021-11-16 17:23 DAVID ROTH <adaptron@comcast.net>
  2021-11-16 17:27 ` Re: Postgres Equivalent of Oracle Package Pavel Stehule <pavel.stehule@gmail.com>
  2021-11-18 03:45 ` Re: Postgres Equivalent of Oracle Package Mladen Gogala <gogala.mladen@gmail.com>
  0 siblings, 2 replies; 5+ messages in thread

From: DAVID ROTH @ 2021-11-16 17:23 UTC (permalink / raw)
  To: pgsql-general

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?





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Postgres Equivalent of Oracle Package
  2021-11-16 17:23 Postgres Equivalent of Oracle Package DAVID ROTH <adaptron@comcast.net>
@ 2021-11-16 17:27 ` Pavel Stehule <pavel.stehule@gmail.com>
  2021-11-16 19:51   ` Re: Postgres Equivalent of Oracle Package DAVID ROTH <adaptron@comcast.net>
  1 sibling, 1 reply; 5+ messages in thread

From: Pavel Stehule @ 2021-11-16 17:27 UTC (permalink / raw)
  To: DAVID ROTH <adaptron@comcast.net>; +Cc: pgsql-general

Hi

út 16. 11. 2021 v 18:23 odesílatel DAVID ROTH <adaptron@comcast.net> napsal:

> 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 use a schemas - you can see it in Orafce

https://github.com/orafce/orafce

Regards

Pavel

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Postgres Equivalent of Oracle Package
  2021-11-16 17:23 Postgres Equivalent of Oracle Package DAVID ROTH <adaptron@comcast.net>
  2021-11-16 17:27 ` Re: Postgres Equivalent of Oracle Package Pavel Stehule <pavel.stehule@gmail.com>
@ 2021-11-16 19:51   ` DAVID ROTH <adaptron@comcast.net>
  2021-11-17 04:13     ` Re: Postgres Equivalent of Oracle Package Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: DAVID ROTH @ 2021-11-16 19:51 UTC (permalink / raw)
  To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: pgsql-general

I can see how schemas can be used to keep related tables and other object together.  I may be missing something but I don't see how they can be used to emulate the "once-per-session" behavior of Oracle packages. Have I missed something?

>     On 11/16/2021 12:27 PM Pavel Stehule <pavel.stehule@gmail.com> wrote:
> 
> 
>     Hi
> 
>     út 16. 11. 2021 v 18:23 odesílatel DAVID ROTH <adaptron@comcast.net mailto:adaptron@comcast.net > napsal:
> 
>         > > 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 use a schemas - you can see it in Orafce
> 
>     https://github.com/orafce/orafce
> 
>     Regards
> 
>     Pavel
> 
> 

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Postgres Equivalent of Oracle Package
  2021-11-16 17:23 Postgres Equivalent of Oracle Package DAVID ROTH <adaptron@comcast.net>
  2021-11-16 17:27 ` Re: Postgres Equivalent of Oracle Package Pavel Stehule <pavel.stehule@gmail.com>
  2021-11-16 19:51   ` Re: Postgres Equivalent of Oracle Package DAVID ROTH <adaptron@comcast.net>
@ 2021-11-17 04:13     ` Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Pavel Stehule @ 2021-11-17 04:13 UTC (permalink / raw)
  To: DAVID ROTH <adaptron@comcast.net>; +Cc: pgsql-general

Hi

út 16. 11. 2021 v 20:51 odesílatel DAVID ROTH <adaptron@comcast.net> napsal:

> I can see how schemas can be used to keep related tables and other object
> together.  I may be missing something but I don't see how they can be used
> to emulate the "once-per-session" behavior of Oracle packages. Have I
> missed something?
>

There is nothing similar in Postgres.

I am working session variables, that should be created in schema too. As
workaround you can use GUC - configuration variables, that can be used for
storing private values too.

Regards

Pavel


> On 11/16/2021 12:27 PM Pavel Stehule <pavel.stehule@gmail.com> wrote:
>
>
> Hi
>
> út 16. 11. 2021 v 18:23 odesílatel DAVID ROTH <adaptron@comcast.net>
> napsal:
>
> 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 use a schemas - you can see it in Orafce
>
> https://github.com/orafce/orafce
>
> Regards
>
> Pavel
>
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Postgres Equivalent of Oracle Package
  2021-11-16 17:23 Postgres Equivalent of Oracle Package DAVID ROTH <adaptron@comcast.net>
@ 2021-11-18 03:45 ` Mladen Gogala <gogala.mladen@gmail.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Mladen Gogala @ 2021-11-18 03:45 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org


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






^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2021-11-18 03:45 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 17:23 Postgres Equivalent of Oracle Package DAVID ROTH <adaptron@comcast.net>
2021-11-16 17:27 ` Pavel Stehule <pavel.stehule@gmail.com>
2021-11-16 19:51   ` DAVID ROTH <adaptron@comcast.net>
2021-11-17 04:13     ` Pavel Stehule <pavel.stehule@gmail.com>
2021-11-18 03:45 ` Mladen Gogala <gogala.mladen@gmail.com>

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