Difference between revisions of "SETRESULTSET()"

From Lianjapedia
Jump to: navigation, search
 
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
[[Category:Database Stored Procedures]]
 
==Purpose==
 
==Purpose==
 
Function to mark an SQL cursor as a resultset
 
Function to mark an SQL cursor as a resultset
 
  
 
==Syntax==
 
==Syntax==
 
SETRESULTSET(<expN>|<expC>)
 
SETRESULTSET(<expN>|<expC>)
 
  
 
==See Also==
 
==See Also==
 
[[CLEARRESULTSET()]], [[GETRESULTSET()]], [[SQL SELECT]]
 
[[CLEARRESULTSET()]], [[GETRESULTSET()]], [[SQL SELECT]]
 
  
 
==Description==
 
==Description==
Line 15: Line 13:
  
 
The GETRESULTSET() function can be used to return the workarea number of an SQL cursor marked as a resultset by SETRESULTSET().  The resultset marker can be cleared from an SQL cursor using the CLEARRESULTSET() function.
 
The GETRESULTSET() function can be used to return the workarea number of an SQL cursor marked as a resultset by SETRESULTSET().  The resultset marker can be cleared from an SQL cursor using the CLEARRESULTSET() function.
 
  
 
==Example==
 
==Example==
Line 34: Line 31:
 
</code>
 
</code>
  
 
==Products==
 
Recital, Recital Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:SQL]]
 
[[Category:SQL]]

Latest revision as of 06:23, 15 December 2017

Purpose

Function to mark an SQL cursor as a resultset

Syntax

SETRESULTSET(<expN>|<expC>)

See Also

CLEARRESULTSET(), GETRESULTSET(), SQL SELECT

Description

The SETRESULTSET() function marks an SQL cursor as a resultset. Any previous SQL cursor marker is cleared. The workarea number or alias name of the cursor should be specified in <expN> or <expC> respectively. The SETRESULTSET() function is particularly used in returning a resultset from a stored procedure in SQL client/server applications.

The GETRESULTSET() function can be used to return the workarea number of an SQL cursor marked as a resultset by SETRESULTSET(). The resultset marker can be cleared from an SQL cursor using the CLEARRESULTSET() function.

Example

function GetExampleCursor
  lparameters lcAccountNo
  select * from example where account_no = lcAccountNo into cursor curExample
return setresultset("curExample")
 
open database southwind
GetExampleCursor("00050")
select * from curexample
? "Cleared resultset marker in work area #" + ltrim(str(clearresultset()))
? iif(getresultset() > 0,"Resultset available in work area #" + ltrim(str(getresultset())),;
       "No resultsets available")
?
close databases