| 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 | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| 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
    begin
      privatevar := val;
    end;
    function f_get_var return varchar2 AS
    begin
      return privatevar;
    end;
  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?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Charles Albrecht | 2002-09-18 23:09:27 | Re: 7.2.2 java configure problem on Mac OS X 10.1.5 | 
| Previous Message | Peter Eisentraut | 2002-09-18 20:08:36 | Re: [NOVICE] Postgres storing time in strange manner |