From the course: Oracle Database 19c: PL/SQL
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Declaring variables - Oracle Database Tutorial
From the course: Oracle Database 19c: PL/SQL
Declaring variables
- You'll create both functions and procedures, and it's likely you'll need to put something in the declaration section to take full advantage of PL/SQL's functionality, such as declaring variables for looping and cursors. Whether I'm writing a function or procedure, the declaration section has the same syntax, so I'll use create procedure for the discussion. Here are the four main areas of the syntax. The last section has the declarations and that declaration can be optional, but in practice I find that I almost always have some variables declared. Here's an overview of a PL/SQL procedure, including the declare section. After the begin keyword is where the PL/SQL statements start running. The exception section is optional and end is the end of the PL/SQL code. Notice that the declare section starts with declare. It will rarely begin with the actual DECLARE keyword because you will only see DECLARE in an anonymous block,…