Rookie Question
Posted: 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?
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);
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
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);
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/