¿How to execute a stored procedure in a remote DB2 database?
How to execute a stored procedure in a remote DB2 database?
Hi Everyone,
I want to access a stored procedure in a remote DB2 database. The stored procedure in question is linked and receives a numeric value, returning a cursor with N number of rows. Sometimes the number of rows reaches hundreds of thousands, so I need to apply pagination.
I've been reading about the %ScrollableResultSet library, but it doesn't allow me to call a stored procedure.
Here's part of the code:
Set pValor=12345678
Set callSql="CALL Paquete.ClaseSpRemoto(?)"
Set rs=##class(%ScrollableResultSet).%New("%DynamicQuery:SQL")
W "ScrollableResultSet Created",!
Set sc = rs.Prepare(callSql)
If ($SYSTEM.Status.IsError(sc)) {w "Prepared: "_$SYSTEM.Status.GetErrorText(sc), ! Quit}
w "Prepared", !
Set sc = rs.Execute(pValor)
If ($SYSTEM.Status.IsError(sc)) {w "Executed: "_$SYSTEM.Status.GetErrorText(sc), ! Quit}
w "Executed", !
The binding also generates a ClassMethod, which was called getList(....)
This is the response to the previous execution:
ScrollableResultSet Created
Prepared: ERROR #6048: Invalid statement type: 'CALL'
Is there a library, or the one mentioned above, that allows paginating the set of rows returned by a stored procedure?
Thank you in advance,