Private field : Package Variables « Function Procedure Packages « Oracle PL/SQL Tutorial






SQL>
SQL> CREATE OR REPLACE PACKAGE valerr
  2  IS
  3     FUNCTION get RETURN VARCHAR2;
  4  END valerr;
  5  /

Package created.

SQL>
SQL> CREATE OR REPLACE PACKAGE BODY valerr
  2  IS
  3     v VARCHAR2(1);
  4
  5     FUNCTION get RETURN VARCHAR2  -- Added Line
  6     IS
  7     BEGIN
  8        RETURN v;
  9     END;
 10  BEGIN
 11     v := 'ABC';
 12
 13  EXCEPTION
 14    WHEN OTHERS
 15    THEN
 16      DBMS_OUTPUT.PUT_LINE ('Error initializing valerr:');
 17      DBMS_OUTPUT.PUT_LINE (SQLERRM);
 18
 19  END valerr;
 20  /

Package body created.

SQL>
SQL>
SQL>








27.12.Package Variables
27.12.1.Package constant variable
27.12.2.Cursor variable in a package
27.12.3.Serially Reusable Packages
27.12.4.Test unit for package scopes
27.12.5.Define constant in a package
27.12.6.Package level cursor variable
27.12.7.Use function to initialize the package level variable
27.12.8.Pre-filled table collection of varchars in a package
27.12.9.Private field
27.12.10.Use package to define variable and use across code blocks
27.12.11.Demonstrate using a packaged ref cursor for passing sets