Announcement Announcement Module
Collapse
No announcement yet.
Invalid length parameter passed to the substring function Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Invalid length parameter passed to the substring function

    I am getting the following error in my StoredProcedure class.

    Code:
    <EXCEPTION OCCURED: org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call dbo.tarcap_DeleteSupvTargets(?, ?, ?, ?, ?, ?, ?)}]; SQL state [HY000]; error code [536]; [IBM][SQLServer JDBC Driver][SQLServer]Invalid length parameter passed to the substring function.; nested exception is java.sql.SQLException: [IBM][SQLServer JDBC Driver][SQLServer]Invalid length parameter passed to the substring function.>
    Here the java code.
    Code:
    public class myStoredProc extends StoredProcedure {
       
        public myStoredProc (DataSource dataSource, String custometSchema) {
           
        	super(dataSource, custometSchema+ EDIT_SP);
        	
        	declareParameter(new SqlParameter("sets", Types.VARCHAR));
        	declareParameter(new SqlParameter("firtName", Types.VARCHAR));
            declareParameter(new SqlParameter("lastName", Types.VARCHAR)); 
            declareParameter(new SqlParameter("Addreess", Types.VARCHAR));
            declareParameter(new SqlParameter("year", Types.VARCHAR)); 
            declareParameter(new SqlParameter("updatedBy", Types.VARCHAR));
            declareParameter(new SqlOutParameter("retcode", Types.INTEGER)); 
        
            compile();
        }
    
        public Map executeSP(SomeDTO myDTO) {
        	
        	Map in = new HashMap();
    
        	in.put("sets", myDTO.getSets());
    	in.put("firstName", myDTO.getFirstName());
        	in.put("lastname", myDTO.getLastName());
        	in.put("Address", myDTO.getSiteName());
        	in.put("year", myDTO.getYear());
        	in.put("updatedBy", myDTO.getUpdateId());
        	
        	Map out = execute(in);
        	return out;
         }
    }

    When I execute the Stored procedure in the Database manually with the same parameters it works just fine. I don't know where its failing. Please help.

    Note: the "sets" is defined as varchar(8000) and takes the string in the format - lastname, firstName|skill^operation;lastname, firstName|skill^operation;lastname, firstName|skill^operation;

    example: Jane, Mary|skill_1A^D;Smith, Will|skill_2A^U;
Working...
X