I want to know how to pass large data to Oracle PL/SQL procedure from a Java class. I am having around 1,500,000 records in file and I want to save it in the database.
Currently I am parsing the file making the collection and sending the ARRAY to the PL/SQL procedure but while making the Oracle ARRAY I am getting the OutOfMemoryError: Java heap size
exception.
Kindly suggest how to get rid of this situation.
I don't have enough knowledge in Oracle. However you can consider the below idea
You can try to read data line by line from file instead of read at once and then move your record into your database as read.
How to read a large text file line by line using Java?
If you want to move data at once to PL SQL, there should be option in Oracle like select into
query to save data as collection and process it further.
https://docs.oracle.com/cd/B14117_01/appdev.101/b10807/13_elems045.htm
Just found the solution of CLOB variable - a Character Large OBject is a collection of character data. I am using the CLOB variable in Java and reading the entire file and inserting it in a temporary table. And from stored procedure I am reading that variable.
Here is the demo:
http://www.idevelopment.info/data/Programming/java/jdbc/LOBS/CLOBFileExample.java
Thanks.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.