Pl SQL Cursors - UrbanPro
UrbanPro
true

Learn PL/SQL from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Pl SQL Cursors

Madhulika N.
27/09/2017 0 0
  • To process an SQL statement, ORACLE needs to create an area of memory known as the context area; this will have the information needed to process the statement.
  • This information includes the number of rows processed by the statement, a pointer to the parsed representation of the statement.
  • In a query, the active set refers to the rows that will be returned.
  • A cursor is a handle, or pointer, to the context area.
  • Through the cursor, a PL/SQL program can control the context area and what happens to it as the statement is processed.
  • Two important features about the cursor are
  • 1.Cursors allow you to fetch and process rows returned by a SELECT statement, one row at a time.

  • There are two types of cursors:

  • 1.An IMPLICIT cursor is automatically declared by Oracle every time an SQL statement is executed. The user will not be aware of this happening and will not be able to control or process the information in an implicit cursor.

    2.An EXPLICIT cursor is defined by the program for any query that returns more than one row of data. That means the programmer has declared the cursor within the PL/SQL code block.

    2.A cursor is named so that it can be referenced.

  • Declaring a cursor defines the name of the cursor and associates it with a SELECT statement.

  • The first step is to Declare the Cursor with the following syntax:

  •   CURSOR c_cursor_name IS select statement

    • Cursor names follow the same rules of scope and visibility that apply to the PL/SQL identifiers.
    • Because the name of the cursor is a PL/SQL identifier, it must be declared before it is referenced.
    • Any valid select statement can be used to define a cursor, including joins and statements with the UNION or MINUS clause.
0 Dislike
Follow 1

Please Enter a comment

Submit

Other Lessons for You

Write a query
To find out how many 'a' characters are present in the string 'database'?

Common mistake even experienced programmers make in Plsql.
Hope, you are aware of Procedures in Plsql. Let us discuss one simple thing which we should always remember while writing the datatype of a parameter for a procedure or a function. Eg: Create or replace...

Starter on exception handling
Just run these two blocks individually, observe the output and comment on what do you understand from it. SET SERVEROUTPUT ONDeclareCursor C is select * from emp;i c%rowtype;BeginFetch C into i;End; SET...

Interview questions based on "level", a pseudocolumn
1. Write a query to get the below output, 1 11 21 31 .. .. 91 2 12 22 32 .. .. 92 3 13 23 33 .. .. 93 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 10 20 30 40 ...

Oracle Architecture - Introduction
As a Oracle developer or a DBA, you should know the in & out of it’s Architecture. Let’s keep it simple first and explore later. Oracle is a software or a program, so like any other program,...

Looking for PL/SQL Classes?

Learn from Best Tutors on UrbanPro.

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more