7.4. Execution Section
The execution section of a PL/SQL block is the only required section. It contains the PL/SQL code that actually performs some action; the exception section also performs an action, but only after being triggered by an action in the execution section. The general syntax of the execution section is:
BEGIN
{assignment_statement |
proc_call |
control_statement |
PL/SQL_block |
SQL
};
[{assignment_statement |
proc_call |
control_statement |
PL/SQL_block |
SQL
}; . . . ]
END;
7.4.1. Assignment Statements
An assignment statement provides a value to a PL/SQL variable. The general syntax of a PL/SQL assignment statement is:
variable := expression;
Keywords
variable
Any previously declared PL/SQL variable.
:=
The PL/SQL symbol for assignment. Note the difference between := and the typical = used in many other languages.
expression
Any valid PL/SQL expression.
7.4.2. Expressions
PL/SQL expressions consist of one or more PL/SQL variables optionally combined with one or more PL/SQL operators. In PL/SQL, an expression may appear in one of the following locations:
On the right side of an assignment statement
As part of a control statement
As part of a SQL statement
The PL/SQL operators that may be used in expressions, along with their relative precedence (where 1 is the highest) are listed in Table 7-4.
| Operator | Description | Type | Precedence |
|---|---|---|---|
| || | Concatenate two character strings | Character | 4 |
| + | Addition | Numeric | 4 |
| + | Unary identity ... |
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