Monday, May 2, 2011

what is Cursors in Oracle , Cursors and Web-Based Applications

SQL retrieval operations work with sets of rows known as result sets. The rows returned are all the rows that match a SQL statement—zero or more of them. Using simple SELECT statements, there is no way to get the first row, the next row, or the previous 10 rows. This is an integral part of how a relational DBMS worksDifferent DBMSs support different cursor options and features. Some of the more common ones are:

The capability to flag a cursor as read-only so that data can be read but not updated or deleted

The capability to control the directional operations that can be performed (forward, backward, first, last, absolute position, relative position, and so on)

The capability to flag some columns as editable and others as not editable

Scope specification so as to be able to make the cursor accessible to a specific request that created it (a stored procedure, for example) or to all requests

Instructing the DBMS to make a copy of the retrieved data (as opposed to pointing to the live data in the table) so that data does not change between the time the cursor is opened and the time it is accessed

Cursors and Web-Based Applications Cursors are rather useless when it comes to Web-based applications (ASP, ColdFusion, PHP, and JSP, for example). Cursors are designed to persist for the duration of a session between a client application and a server, but this client/server model does not fit in the Web application world because the application server is the database client, not the end user. As such, most Web application developers avoid the use of cursors and re-create the functionality themselves if needed.