Programming Guide



OCCUR

Changes the behavior of a SELECT cursor that writes to Panther arrays

Synopsis

DBMS [WITH CURSOR cursor] OCCUR occInt [MAX int]
DBMS [WITH CURSOR cursor] OCCUR CURRENT [MAX int]

Arguments

WITH CURSOR cursor
Name of declared SELECT cursor. If the clause is not used, Panther uses the default SELECT cursor.

occInt
Occurrence number where Panther should begin placing SELECT results.

CURRENT
Specifies that Panther use the occurrence number of the "current" field. Panther begins writing at this occurrence number in the target arrays. The current field is the one containing the Panther screen cursor and is not necessarily a target variable.

MAX int
Specify maximum number of rows to fetch for a SELECT or CONTINUE. If int is less than 1, no rows are fetched.

Description

By default, if the destination of a SELECT is one or more arrays, Panther fetches as many rows as will fit in the arrays and begins writing at the first occurrence in the arrays. DBMS OCCUR changes this default behavior for a SELECT cursor.

The setting is turned off by executing the DBMS OCCUR command with no arguments. Closing a cursor also turns off the setting. If a cursor is redeclared without being closed, the cursor continues to use the setting for SELECT statements and CONTINUE commands.

DBMS OCCUR is ignored with a CATQUERY cursor.

Example

// When executed, this procedure starts writing
// the result set at the current occurrence.
proc select_type
DBMS DECLARE genre_cursor CURSOR FOR \
SELECT * FROM titles WHERE genre_code = :+code
DBMS WITH CURSOR title_cursor OCCUR CURRENT
DBMS WITH CURSOR title_cursor EXECUTE
return