We are calling PL/SQL Stored Procedures in Java code. Sometimes the package is taking a very long time to return the result. Is it possible to come out of the PL/SQL call and write an log in java?
Please see the below Java code:
long startTime = 0L;
long endTime = 0L;
startTime = System.currentTimeMillis();
logger.info("Starting Time PKGSM2_TOOLS Alerts Package ------->"+startTime);
CallableStatement statement= con.getConnection().prepareCall("{call PKGSM2_CONTROL_CHART.PROC_INDICATORCHART_ECHARANGE(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
statement.executeQuery();
endTime = System.currentTimeMillis();
logger.info("Ending Time PKGSM2_TOOLS Alerts Package ------->"+endTime);
logger.info("Total Package Execution Time Duration of Alerts Package ------->"+(endTime - startTime)+"ms");
In the above code if the PL/SQL package takes more time and the request resides inside the package. Is it possible to exit from the call if the package call takes more than 2 minutes?
And also what will be reason for Long Active Session Inside the PL/SQL Stored procedure?