Have you ever faced this exception while executing sql query in your software or database?? Well, I am using Java programming language in the front end and PostGreSQL in the backend i.e. server side. Recently I have faced the following exception which was showing actually from the database. I searched internet for the solution but didn’t get any reliable solution. But at last I have solved it and sharing the solution procedure with you. Hope it will also work with your problem
Here is the problem (Exception)
Batch entry 0 insert into endproduct_mat_req(item_no,end_product_mat_no,mat_no,qty) values(523,71,44,100000.0) was aborted. Call getNextException to see the cause
Here Is the Database (PostGreSQL) Table which I am using in our ERP software
While Checking the log (output from System.out.println() function) What I have found, the following data was inserting in my table.
Here, What I have noticed, when Big Decimal value is going to six digits ( means, 1 lakh ) it is throwing this exception, this big decimal value was saving in the qty field of endproduct_mat_req table.
Solution:
I have got one solution, the qty field in endproduct_mat_req table was numeric(15,5). To solve this exception I just increased the size of the qty field as below
After changing the size of qty field the exception gone.
I have the same exception on my Java web application which uses Postgresql database. In my situation, the cause of the exception is, trying to set null values to not null set columns in the db.
I hope that information will be useful.
LikeLike
I have the same exception , null’s are not accepted in postgresql for not null , make sure that they have defaults or provide any value while insertion , for my problem i have used 0000-00-00 as date.
LikeLike