Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

OLE DB Retrieval using cursors – PB Docs 2021 – PowerBuilder Library

OLE DB Retrieval using cursors – PB Docs 2021

OLE DB
Retrieval using cursors

Retrieval using cursors is conceptually similar to the singleton
SELECT discussed earlier. The main difference is that since there can be
multiple rows in a result set, you control when the next row is fetched
into PowerScript variables.

For example, if you expect only a single row to exist in the
employee table for each emp_id, use a singleton SELECT statement. In a
singleton SELECT, you specify the SELECT statement and destination
variables in one concise SQL statement:

However, if the SELECT may return multiple rows, you must:

  1. Declare a cursor.

  2. Open it (which conceptually executes the SELECT).

  3. Fetch rows as needed.

  4. Close the cursor.

Declaring and opening a
cursor

Declaring a cursor is tightly coupled with the OPEN statement. The
DECLARE specifies the SELECT statement to be executed, and the OPEN
actually executes it.

Declaring a cursor is similar to declaring a variable. A cursor
declaration is a nonexecutable statement just like a variable declaration.
The first step in declaring a cursor is to define how the result set
looks. To do this, you need a SELECT statement, and since you must refer
to the result set in subsequent SQL statements, you must associate the
result set with a logical name.

Example

Assume the SingleLineEdit sle_1 contains the state code for the
retrieval:

Fetching rows

The PowerBuilder OLE DB interface supports FETCH statements.

See also

OLE DB FETCH
NEXT


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x