1

I am running some DB2 queries and after that I am calling a PL sql procedure

calling of Procedure is

CallableStatement callStmt = con.prepareCall( //
        "CALL INIT_PAYROLL(?,?,?,?,?,?,?,?,?,?)");
// Set IN parameters
callStmt.setString(1, start_date);//IN
callStmt.setString(2, end_date); //IN
callStmt.setInt(3, customer_id);//IN
callStmt.setString(4, payrollMain_id+"");//IN
callStmt.setString(5, ruleFreq );//IN
callStmt.setInt(6, 0);
callStmt.setString(7, outerArray);//IN
callStmt.setString(8, commsSepEmps);//IN
callStmt.setInt(9, isIncremental);
callStmt.registerOutParameter (10, Types.VARCHAR);
//Call the procedure
callStmt.executeUpdate();
toReturnStatus = callStmt.getString(10);
System.out.println("OutPutResult--    : " + toReturnStatus);

But some strange problem I am facing. I am clueless about why that is happening. error snapshot

Another Question is if I call this procedure from within of Java files, and If an exception occurs in PLSql procedure, will the exception be printed as DB2 exception?

enter image description here

Error :

[2/27/15 17:00:15:778 IST] 0000280f SystemErr     R com.ibm.db2.jcc.am.SqlDataException: DB2 SQL Error: SQLCODE=-433, SQLSTATE=22001, SQLERRMC=129727:12068,133389:12069,133390:12070,133391:12071,133393:1, DRIVER=3.62.56

in this error 129727:12068 , is employee_id:primaryKeyOFtable ,

EDIT : The SP don't give problem in every case, I pass comma separated employeeIds in SP, only when it exceeds some certain limit/length, it fails and give this error.

EDIT I solved/found the error, Actually I was passing a String whose length was exceeding the defined VarChar limit. :)

3
  • Try running your SP from SSMS. Commented Mar 11, 2015 at 4:41
  • No, it don't fails in every case. I have updated the Details ,please check. Commented Mar 11, 2015 at 4:51
  • 1
    Did you have a chance to read the explanation of SQLCODE -433 in the manual? Commented Mar 11, 2015 at 11:41

1 Answer 1

1

22001 means Character data, right truncation occurred; for example, an update or insert value is a string that is too long for the column, or a datetime value cannot be assigned to a host variable, because it is too small.

Here is the link with different DB2 error codes https://urssanj00.wordpress.com/2008/03/04/db2-sql-error-code-and-description/

Sign up to request clarification or add additional context in comments.

1 Comment

Exactly , Actually I solved this problem couple of days back. What actually was happening that, I was passing a string whose length was exceeding defined varchar limit. :) Thanks for help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.