Microsoft SQL Server FETCH – PB Docs 126

Microsoft SQL Server FETCH

To access rows returned in a result set, you use the FETCH
statement the same way you use it for cursors. The FETCH statement
can be executed after any EXECUTE statement that refers to a procedure
that returns a result set.

Example 1

You can use this FETCH statement only to access values produced
with a SELECT statement in a database stored procedure. You cannot
use the FETCH statement to access computed rows.

Database stored procedures can return multiple result sets.
Assume you define a database stored procedure proc2 as follows:

PowerBuilder provides access to both result sets:

The result sets that will be returned when a database stored
procedure executes cannot be determined at compile time. Therefore,
you must code FETCH statements that exactly match the format of
a result set returned by the stored procedure when it executes.

Example 2

In the preceding example, if instead of coding the second
fetch statement as:

coded it as:

statement would compile without errors. But an execution error would occur:
the number of columns in the FETCH statement does not match the number
of columns in the current result set. The second result set returns
values from only one column.

See also

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x