SQL/MP Programming Manual for C

Data Retrieval and Modification
HP NonStop SQL/MP Programming Manual for C429847-008
4-16
Process Access ID (PAID) Requirements
Process Access ID (PAID) Requirements
To use an SQL cursor, a process started by the program must have the access
authority shown in this table. NonStop SQL/MP checks this authority when the program
opens the cursor. For details, see Required Access Authority on page 7-1.
A program can use a cursor whose declaration does not specify FOR UPDATE to
locate rows in a table to delete. NonStop SQL/MP tests the table only for read access
when the OPEN statement runs. However, because a DELETE operation requires
write access, NonStop SQL/MP checks for write access when you run the DELETE
statement.
A program contending for data access with other users can specify the IN EXCLUSIVE
MODE clause in the associated SELECT statement. NonStop SQL/MP then does not
have to convert the lock for a subsequent UPDATE or DELETE operation. However, if
a program is reading records accessed concurrently by a cursor defined with an IN
EXCLUSIVE MODE clause in another program, the first program must wait to access
the data.
Cursor Position
Table 4-2 describes the SQL statements that affect the cursor position in a program.
The cursor position is similar to the record position in a sequential file.
Access SQL Objects
Read Tables or protection views referred to in the SELECT statement associated with
the cursor (that is, specified in the DECLARE CURSOR statement)
Read Tables or protection views underlying the shorthand view, if the cursor refers to a
shorthand view
Write Tables referenced, if the cursor declaration includes the FOR UPDATE clause
Table 4-2. Determining the Cursor Position
SQL Statement Cursor Position or Action
OPEN Positions the cursor before the first row.
FETCH Positions the cursor at the retrieved row (or the current
position).
DELETE Positions the cursor between rows. For example, if the
current row is deleted, the cursor is positioned either
between rows or before the next row and after the
preceding row.
SELECT Determines the order in which the rows are returned. To
specify an order, include an ORDER BY clause.
Otherwise, the order is undefined.
CLOSE Causes no position; release the result table established
by the cursor.