I have implemented a stored procedure that generates a csv report based on the data in a transaction_table
, and stores the generated report in report_table
for future references.
I execute and pass arguments to this procedure using JPA in a java program and it works perfectly fine.
Problems are:
- since we have huge amount of transaction data in
transaction_table
, it takes some time for report to be generated. And during this time the the pop-up thread responsible for generating the report is blocked. - If database connection for running the procedure gets broken in the middle of execution, not even we don't get the report , but also the database thread responsible for handling the request does not get completed and remains in the memory in some unknown state.So we need an active connection with database during execution time.
My questions are:
- Is there any way to call procedure and return immediately, without having a thread in the application blocked for entire execution time of stored procedure.
- Since there is a chance of losing the database connection, is there any way that database can run the procedure independently from the application that is calling it, so that it gets completed even in the absence active connection.
Note that I need to pass the report parameters from application to the procedure.
I have Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production, running on the server.