Chapter 7. Working with Program Data
Almost every PL/SQL block you write will define and manipulate program data. Program data consists of data structures that exist only within your PL/SQL session (physically, within the Program Global Area, or PGA, for your session); they are not stored in the database. Program data can be:
- Variable or constant
The values of variables can change during a program’s execution. The values of constants are static once they are set at the time of declaration.
- Scalar or composite
Scalars are made up of a single value, such as a number or a string. Composite data consists of multiple values, such as a record, a collection, or an object type instance.
- Containerized
Containers may contain information obtained from the database, or data that was never in the database and might not ever end up there.
Before you can work with program data inside your PL/SQL code, you must declare data structures, giving them names and datatypes.
This chapter describes how you declare program data. It covers the rules governing the format of the names you give them. It offers a quick reference to all the different types of data supported in PL/SQL and explores the concept of datatype conversion. The chapter finishes with some recommendations for working with program data. The remaining chapters in this part of the book describe specific types of program data.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access