Stproc cursor()
syntax: |
stproc.cursor([updateable]) |
where: |
updateable - Boolean parameter indicating whether the cursor can be modified.
|
return: |
A new Cursor object, representing the results of the stored procedure.
|
description: |
This method creates a Cursor object that contains the rows returned by the SQL SELECT statement of the stored procedure object. If the SELECT statement does not return any rows, the resulting Cursor object also has no rows.
The optional mode parameter specifies how the Cursor object will access and modify records. The options for this field are:
Database.snapshot - uses SQLExtendedFetch, static cursor
Database.dynaset - uses SQLExtendedFetch, keyset driven cursor
Database.forwardOnly - uses SQLFetch
Database.dynamic - uses SQLExtendedFetch, dynamic cursor
If no value is specified in the mode parameter, the cursor is created Database.snapshot.
If an updateable Cursor object is desired, the virtual table generated by the stored procedure must be updateable. For example, the SELECT statement cannot contain a GROUP BY clause. In addition, the query usually must retrieve key values from a table. For more information on constructing updateable queries, consult your database vendor's documentation.
|
see: |
#link <sedbc>, Cursor object, Stproc execute()
|
example: |
// create a SQL stored procedure SQL = "select id, cust_name, city from customer" "where (id >=?) and (id <=?)"; sp = database.storedProc(SQL);
// set the parameters sp[0] = 1000; sp[1] = 2000;
// create the cursor custs = sp.cursor(true) |