Difference between revisions of "GETRESULTSET()"

From Lianjapedia
Jump to: navigation, search
m (Text replace - "Recital" to "Lianja")
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to return the workarea number of an SQL cursor previously marked as a resultset
 
Function to return the workarea number of an SQL cursor previously marked as a resultset
 
  
 
==Syntax==
 
==Syntax==
 
GETRESULTSET()
 
GETRESULTSET()
 
  
 
==See Also==
 
==See Also==
 
[[CLEARRESULTSET()]], [[SQL SELECT|SELECT]], [[SETRESULTSET()]]
 
[[CLEARRESULTSET()]], [[SQL SELECT|SELECT]], [[SETRESULTSET()]]
 
  
 
==Description==
 
==Description==
Line 15: Line 12:
  
 
GETRESULTSET() will return 0 (zero) if no SQL cursor is currently marked as a resultset.  The marker can be cleared from an SQL cursor using the CLEARRESULTSET() function.
 
GETRESULTSET() will return 0 (zero) if no SQL cursor is currently marked as a resultset.  The marker can be cleared from an SQL cursor using the CLEARRESULTSET() function.
 
  
 
==Example==
 
==Example==
Line 22: Line 18:
 
   lparameters lcAccountNo
 
   lparameters lcAccountNo
 
   select * from example where account_no = lcAccountNo into cursor curExample
 
   select * from example where account_no = lcAccountNo into cursor curExample
return setresultset("curExample")
+
  return setresultset("curExample")
 +
endfunc
  
 
open database southwind
 
open database southwind
 
GetExampleCursor("00050")
 
GetExampleCursor("00050")
 
? "Returned resultset is in work area #" + ltrim(str(getresultset()))
 
? "Returned resultset is in work area #" + ltrim(str(getresultset()))
set sql off
 
 
select getresultset()
 
select getresultset()
 
display all
 
display all
Line 36: Line 32:
 
close databases
 
close databases
 
</code>
 
</code>
 
  
 
==Products==
 
==Products==
Lianja Server, Lianja
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:SQL]]
 
[[Category:SQL]]

Latest revision as of 04:45, 4 October 2013

Purpose

Function to return the workarea number of an SQL cursor previously marked as a resultset

Syntax

GETRESULTSET()

See Also

CLEARRESULTSET(), SELECT, SETRESULTSET()

Description

The GETRESULTSET() function returns the workarea number of an SQL cursor previously marked as a resultset by the SETRESULTSET() function. The SETRESULTSET() function is particularly used in returning a resultset from a stored procedure in SQL client/server applications.

GETRESULTSET() will return 0 (zero) if no SQL cursor is currently marked as a resultset. The 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")
endfunc
 
open database southwind
GetExampleCursor("00050")
? "Returned resultset is in work area #" + ltrim(str(getresultset()))
select getresultset()
display all
? "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

Products