Oracle to PostgreSQL: Packages - Mailing list pgsql-novice

From Mark Wilson
Subject Oracle to PostgreSQL: Packages
Date
Msg-id 002c01c25f63$df1ac5f0$3301a8c0@merl
Whole thread Raw
List 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?
 

pgsql-novice by date:

Previous
From: "Michael Paesold"
Date:
Subject: Re: Serial Field Autoincrementing
Next
From: Charles Albrecht
Date:
Subject: Re: 7.2.2 java configure problem on Mac OS X 10.1.5