BBjStoredProcedureData::setResultSet

Description

In BBj 6.00 and higher, this method sets the channel to be used as the stored procedure's result set.

Syntax

Return Value Method
void setResultSet(int sqlChannel)
void setResultSet(java.sql.ResultSet resultSet)

Parameters

Parameter Description
sqlChannel Handle of the SQL channel to use as a result set.
resultSet Instance of java.sql.ResultSet to return.

Return Value

None.

Remarks

Either this method or setUpdateCount can be called once. Subsequent invocations result in an !ERROR=207 (BBJ_STATE).

Example 1

rem 'A sample Stored Procedure program

rem 'Get a Stored Procedure object from the BBj File System
sp! = BBjAPI().getFileSystem().getStoredProcedureData()

rem 'Get the input parameter from the application
NAME$ = sp!.getParameter("NAME")

rem 'Open up the database that the client application is using
con! = BBjAPI().getJDBCConnection(sp!.getDatabaseName())

rem 'Now generate and return the result set back to the client application
stmt! = con!.prepareStatement("select * from customer where first_name like ?")
stmt!.setString(1, NAME$)
rs! = stmt!.executeQuery()
sp!.setResultSet(rs!)

Example 2

rem 'A sample Stored Procedure program

rem 'Get a Stored Procedure object from the BBj File System
sp! = BBjAPI().getFileSystem().getStoredProcedureData()

rem 'Get the input parameter from the application
NAME$ = sp!.getParameter("NAME")

rem 'Open up the database that the client application is using
chan = unt
sqlopen(chan)"BASIS.DB_CONNECTION"

rem 'Now generate and return the result set back to the client application
sqlprep(chan) "select * from customer where first_name like ?"
sqlexec(chan) NAME$
sp!.setResultSet(chan)
sqlclose(chan)

See Also

BBjAPI

Object Variables

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.