April 17, 2016

JavaEE : oracle.jdbc.OracleTypes for CallableStatement.registerOutParameter with SYS_REFCURSOR

This is a procedure which has one out parameter of SYS_REFCURSOR type.
PROCEDURE p_get_data(query_result OUT SYS_REFCURSOR);

In java for working out with this procedure you need to import ojdbc14.jar and need to set registerOutParameter type as OracleTypes.CURSOR
import oracle.jdbc.driver.OracleTypes;

CallableStatement callStmt = connection.prepareCall("{call p_get_data(?)}");
callStmt.registerOutParameter(1, OracleTypes.CURSOR);
ResultSet resultSet = (ResultSet) callStmt.getObject(1);
if(resultSet.next()) {
//Your Code here



We shall not be liable for the improper or incomplete transmission of the information contained in this communication nor for any delay in its response or damage to your system. We do not guarantee that the integrity or security of this communication has been maintained or that this communication is free of viruses, interceptions or interferences. Anyone communicating with us by email accepts the risks involved and their consequences. We accept no liability for any damage caused by any virus transmitted by this site.