Skip site navigation (1) Skip section navigation (2)

Oracle to PostgreSQL: Packages

From: "Mark Wilson" <mark(at)mediasculpt(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Oracle to PostgreSQL: Packages
Date: 2002-09-18 22:36:41
Message-ID: 002c01c25f63$df1ac5f0$3301a8c0@merl (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
In oracle you can have private variables within your package, e.g.

  create or replace package examplepackage as
    procedure p_set_var(val varchar2);
    pragma restrict_references(p_set_var, rnps, rnds, wnds);
    function f_get_var return varchar2;
    pragma restrict_references(f_get_var, wnps, rnds, wnds);
  end examplepackage;
  show errors;

  create or replace package body examplepackage as
    privatevar varchar2(32);
    procedure p_set_var(
      val varchar2
    ) AS
      privatevar := val;
    function f_get_var return varchar2 AS
      return privatevar;
  end examplepackage;
  show errors;

  execute examplepackage.p_set_var('a');
  select examplepackage.f_get_var from dual;

This allows you to effectively use session or transaction variables within your code. Is there a way to emulate this in PostgreSQL?

pgsql-novice by date

Next:From: Charles AlbrechtDate: 2002-09-18 23:09:27
Subject: Re: 7.2.2 java configure problem on Mac OS X 10.1.5
Previous:From: Peter EisentrautDate: 2002-09-18 20:08:36
Subject: Re: [NOVICE] Postgres storing time in strange manner

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group