3

I'm trying to frame a select query using JPA repository.

select * 
from Foo 
where name = 'testapp'.

The "NAME" column is defined as varchar(4). My program throws SQLCODE=-302, SQLSTATE=22001 for the select operation whereas I get the same query working in the SQL developer IDE.

DarkCrow
  • 785
  • 2
  • 8
  • 29
  • 1
    This is the reason:https://stackoverflow.com/questions/9625336/sqlexception-db2-sql-error-sqlcode-302-sqlstate-22001-sqlerrmc-null – soorapadman Jun 15 '17 at 09:38
  • 1
    Possible duplicate of [SqlException: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC: null](https://stackoverflow.com/questions/9625336/sqlexception-db2-sql-error-sqlcode-302-sqlstate-22001-sqlerrmc-null) – mustaccio Jun 15 '17 at 13:13
  • I know my input variable is larger than the defined column size, Why would select query worry about that? I'm not inserting anything.Like I said this query works just fine in the SQL developer IDE. – DarkCrow Jun 16 '17 at 09:01
  • I am having the same issue, have your problem solved? – Solomon Tam Feb 13 '18 at 05:56
  • Yes some DB's will not allow you to do a select query with the value which is more than the defined column size. – DarkCrow Feb 14 '18 at 14:05

0 Answers0