Inserting values into integer column

Database
Enthusiast

Inserting values into integer column

i want to insert the following
insert into financial.test_data_GEN(b) values(1+2||1)

when i try to do this i am getting the following error message

Bad character in format or data of test_data_GEN.b., SQL State: HY000, Error Code: 2621

pls help me reg. this
3 REPLIES
Junior Contributor

Re: Inserting values into integer column

Why do you use string operations when you want to insert into an INT column?

Submit
SELECT 1+2||1;
see the result, then you know why it's failing.

Dieter

Enthusiast

Re: Inserting values into integer column

I want to concatenate 1+2||1 i.e i want the output as 31 to be inserted in the integer column.

pls help me in concatenating integer values
Junior Contributor

Re: Inserting values into integer column

Why do you assume that 1+2||1 will result in 31?
Could be 22, too :-)

trim(1+2) || trim(1)

Dieter