Skip to main content
← PL/SQL Topics

Packages & Modularity

Explain PRAGMA SERIALLY_REUSABLE

PRAGMA SERIALLY_REUSABLE

ExplanationOracle Fusion / EBS · Technical · PL/SQLHigh confidenceGenerated

It tells Oracle not to keep a package's state across calls — memory is released after each server call.

How it works

Normally package state (spec variables, cursors, the initialization block's effects) lives for the whole session. PRAGMA SERIALLY_REUSABLE, placed in the spec (and body if it has one), makes the package state last only for one server call: it is reinitialised on the next call and the memory returns to the pool. It suits large work areas you do not want to hold per session, but breaks any design that deliberately caches across calls, and it cannot be used from a single SQL statement's context.

How it works
CREATE OR REPLACE PACKAGE scratch_pkg IS
  PRAGMA SERIALLY_REUSABLE;
  g_buffer  DBMS_SQL.VARCHAR2A;      -- large, rebuilt every call
  PROCEDURE load;
END scratch_pkg;
/
CREATE OR REPLACE PACKAGE BODY scratch_pkg IS
  PRAGMA SERIALLY_REUSABLE;
  PROCEDURE load IS
  BEGIN
    g_buffer.DELETE;                 -- always starts empty each server call
    -- ... fill g_buffer ...
  END;
END scratch_pkg;
/

Related questions

GroundingGenerated

Model-generated, grounded against the curated knowledge layer. Check specifics against your instance.

Have a follow-up, or a different question?

Continue in Ask Oracle AI