Conversion failed in host variable or * N parameter

I get this error in the Insert statement in the AS400 database using Java with JDBC.

+4
source share
3 answers

I realized I had a number field with a length of 4 and decimal digits 2. In my insert, I tried to insert 100 into this number field that gave this error.

I altered the table and made it numeric with length 9 and decimal digits 2 
and the insert worked.

although the error indicates the error "Conversion Error", this is actually the wrong field length.

+6
source

, ​​ 2 3 , , ​​ 3 . Alter Table, , .

alter table "Table Name" ALTER COLUMN "COLUMN NAME" SET DATA TYPE NUMERIC(3)

:

* N (# -302) [IBM] [ iAccess ODBC Driver] [DB2 for i5/OS] SQL0012 - " " " ". (# 12)

+1

, :

select *
from mytable
where invoice_date >= '2019-01-01'

- "" ... , . , , , , :

select *
from mytable
where invoice_date >= 20190101
0

Source: https://habr.com/ru/post/1717369/


All Articles