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 cursors

Declaring cursors

- [Instructor] When you create functions and procedures, it's likely you'll put something in the declaration section to take full advantage of the PL/SQL functionality, such as looping and cursors, but that's not the only place where you can declare a cursor. Here's how cursor declarations fit in with the basic structure of a PL/SQL procedure or function. The first section, the declare section is optional. A cursor can be declared here. Starting with the begin keyword, that's where the PL/SQL statements start running, and you can also implicitly declare and use a cursor here. What is a cursor by the way? It's a pointer defined somewhere in a PL/SQL procedure. It can be either a SELECT statement or any DML statement. Cursors are defined in either the declaration section or between the begin and end blocks. I'll show you an example of both in this video. Every cursor has built-in variables that begin with SQL percent sign.…

Contents