Home » questions » What is the difference between a CURSOR and a VIEW in Oracle PL/SQL?

What is the difference between a CURSOR and a VIEW in Oracle PL/SQL?

2006-08-07 19:47:27, Category: Programming & Design

Answers

  1. sysengineer67

    On 2006-08-07 19:55:25


    A View is a logical construct in the database. You basically create a virtual table in the database with a pre-defined query. Any other query can use the view. A Cursor is a pointer to a query that will be run inside a PL/SQL script. In the script you execute the query, the cursor essentially points to the first row of the results. You can then move the cursor to the next row, and the next row, and so on until you reach the last row.
  2. takicutie2004

    On 2006-08-07 19:54:45


    well a view just represents a select statement in a table view. Yes you can make use of that view in queries, but its difficult to store some items in variables. The cursor on the other hand contains the query and is represented with a variable that can easily extract values per record. So you can easily do looping statements to extract data.