Declaring Variables and Assigning Values

The power of PL/SQL is that it allows the developer to read data into the code block and to manipulate it. In order to bring the attributes into the program, you must have variables that will hold the values. Oracle cannot use the values until they are placed into memory, which happens when they are assigned to a variable. Variables are defined in the declaration section of the code block and will be discussed in this section.

Defining Variables

Variables are defined in the declaration section of the program. The syntax is as follows:

					Variable_name                   datatype(precision);
				

Oracle treats a variable definition similarly to other statements. The definition must end with a semicolon. The definition statement ...

Get Oracle SQL and PL/SQL Handbook: A Guide for Data Administrators, Developers, and Business Analysts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.