Why cursor is used in oracle




















When an SQL statement is processed, Oracle creates a memory area known as context area. A cursor is a pointer to this context area. It contains all information needed for processing the statement. A cursor contains information on a select statement and the rows of data accessed by it. A cursor is used to referred to a program to fetch and process the rows returned by the SQL statement, one at a time. There are two types of cursors:. The implicit cursors are automatically generated by Oracle while an SQL statement is executed, if you don't use an explicit cursor for the statement.

Orcale provides some attributes known as Implicit cursor's attributes to check the status of DML operations. It will return an error if there no data is selected. Let's execute the following program to update the table and increase salary of each customer by The Explicit cursors are defined by the programmers to gain more control over the context area.

You can fetch rows from the above-opened cursor as follows:. The following syntax is used to close the above-opened cursors. To open a cursor, you use the following syntax:. When you open a cursor, Oracle parses the query, binds variables, and executes the associated SQL statement. Oracle also determines an execution plan, associates host variables and cursor parameters with the placeholders in the SQL statement, determines the result set, and sets the cursor to the first row in the result set.

More about parameterized cursor in the next tutorial. Cursors are the temporary private working area where queries are processed. Implicit Cursors and Explicit Cursors are two types of Cursors. This article introduces the term "Cursors" in Oracle.

Cursors In Oracle, Cursors are the temporary private working area where queries are processed. It is used to access the result set present in memory. A cursor contains the information on a select statement and the rows of the data accessed by it. Features of Cursors Cursors consist of the following two features: It allows us to fetch and process rows returned by the select statement. This has been a guide to Cursor in Oracle.

Here we discuss the introduction, cursor types, advantages, disadvantages, and example of cursor in oracle. You may also have a look at the following articles to learn more —. Submit Next Question. By signing up, you agree to our Terms of Use and Privacy Policy. Forgot Password? This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy.

By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy.



0コメント

  • 1000 / 1000