Avatar of chinmaya224
chinmaya224Flag for India

asked on 

Need clarification on PL/SQL Package

I have some doubt on PL/SQL Package. Please explain me, need your help for the below.

Please check the below program:
CREATE OR REPLACE PACKAGE valerr
IS
   FUNCTION private_variable RETURN VARCHAR2;
END valerr;
/

CREATE OR REPLACE PACKAGE BODY valerr
IS
   g_private   VARCHAR2 (1);

   FUNCTION private_variable
      RETURN VARCHAR2
   IS
   BEGIN
      RETURN g_private;
   END private_variable;

   PROCEDURE initialize
   IS
   BEGIN
      DBMS_OUTPUT.put_line ('Before I show you v...');
      g_private := 'abc';
   EXCEPTION
      WHEN OTHERS
      THEN
         DBMS_OUTPUT.put_line ('Trapped the error!');
   END initialize;
BEGIN
   initialize;
END valerr;
/

Now Please explain me on my below points:
1. When i am login through a new session, only specification will be loaded in SGA or both body or specification or specification and Declarative part of body.
2. When the body will be loaded.
3. What is the internal process of Oracle when we are executing a procedure of a package.

Thanks in advance
Oracle Database

Avatar of undefined
Last Comment
chinmaya224
Avatar of johnsone
johnsone
Flag of United States of America image

Neither the header or the body will be loaded until a function within the package is executed.

http://docs.oracle.com/cd/E11882_01/server.112/e40540/memory.htm#sthref1763
Avatar of chinmaya224
chinmaya224
Flag of India image

ASKER

it means that when ever we will call a procedure of a package then only it will be loaded into the memory.

So suppose if i am executing the procedure of a package second time then it will execute the procedure which is already loaded into the memory.

@johnsone - wheather the specification is also loaded/intialized when we execute the Procedure ?
ASKER CERTIFIED SOLUTION
Avatar of johnsone
johnsone
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of chinmaya224
chinmaya224
Flag of India image

ASKER

Thanks for your clarification ...
Oracle Database
Oracle Database

Oracle is an object-relational database management system. It supports a large number of languages and application development frameworks. Its primary languages are SQL, PL/SQL and Java, but it also includes support for C and C++. Oracle also has its own enterprise modules and application server software.

81K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo