Packages Flashcards
What are packages?
Schema objects that groups logically related PL/SQL types, variables, and subprograms
What are the two components of a package?
- Package specification
- Package body or definition
What does the package specification do?
DECLARES the types, variables, constants, exceptions, cursors, and subprograms that can be referenced from outside the package
All objects placed in the specification are called ____
Public objects
Any subprogram not in the package specification but coded in the package body are called ___
Private objects
What is the syntax for the package specification?
CREATE OR REPLACE PACKAGE name IS
–Declaration of global variables, types, cursors
–Headers of public procedures & functions public (implicit)
END name;
What is the package body?
Has the codes for various methods declared in the package specification and other private declarations
What is the syntax for the package body?
CREATE OR REPLACE PACKAGE BODY name IS
#Declare private variables, types, cursors
#Code public and private functions and procedures
END name;
Where is package code loaded on first call?
Memory
What permissions does the package have run you run the code?
The same of the owner of the package
Can you compile the specification and body separately?
Yes
What is the syntax for accessing package elements?
package_name.element_name;