I was looking for examples on how to execute stored procedures and i found the code below. Can anyone tell me why
JDBC_getMoreResults() is called after the do while IsResultSet(), would not the JDBC_getResultSet() call get every
item in the record set?
Thanks for any answer.
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
dcl-sstmt like(CallableStatement);
dcl-srs like(ResultSet);
dcl-sIsResultSet ind;
... Connect as before, etc....
stmt = JDBC_PrepCall( conn : 'call order_new(012001)' );
IsResultSet = JDBC_execCall( stmt );
dow IsResultSet;
rs = JDBC_getResultSet( stmt );
dowJDBC_nextRow(rs);
field1 = JDBC_getCol(rs: 1);
field2 = JDBC_getColByName(rs: 'SHIPNAME');
... do something with the data...
enddo;
IsResultSet = JDBC_getMoreResults( stmt );
enddo;
JDBC_FreeCallStmt(stmt);
JDBC_Close(conn);
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Rookie Question
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Rookie Question
Stored procedures can have multiple result sets. This code iterates through all of the result sets. JDBC_getResultSet() only gets one of them. JDBC_getMoreREsults() advances to the next result set so you can get that.Angel.Bermudez wrote: ↑Thu Dec 12, 2024 4:15 pm I was looking for examples on how to execute stored procedures and i found the code below. Can anyone tell me why
JDBC_getMoreResults() is called after the do while IsResultSet(), would not the JDBC_getResultSet() call get every
item in the record set?