Lab 4.1 Making Use of DML in PL/SQL

Lab Objectives

After this Lab, you will be able to:

Use the SELECT INTO Syntax for Variable Initialization

Use DML in a PL/SQL Block

Make Use of a Sequence in a PL/SQL Block

Variables Initialization with SELECT INTO

In PL/SQL, there are two main methods of giving value to variables in a PL/SQL block. The first one, which you learned in Chapter 2, “PL/SQL Concepts,” is initialization with the “:=” syntax. In this lab we will learn how to initialize a variable with a select statement by making use of SELECT INTO syntax.

A variable that has been declared in the declaration section of the PL/SQL block can later be given a value with a SELECT statement. The correct syntax is as follows:

 SELECT item_name ...

Get Oracle® PL/SQL® Interactive Workbook, Second Edition 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.