Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Message détaillé: Type mismatch: cannot convert from int to String

Hello i have a problem with the use of talend.
Here I have a sql request and I would like to directly implement it in tDBRow or tDBInput with type of request:

SELECT
ACCOUNT.CUST_ID,
count(ACCOUNT.ACCOUNT_ID) as cas1,
count(ACCOUNT.CUST_ID)*100/48 as cas2
FROM ACCOUNT
WHERE CUSTOMER.avail_balance <= 1000
GROUP BY account.cust_id

 

But when I compile, I have the following error: "Line in error: 1191
Detailed message: Type mismatch: can not convert from int to String "

Any help to fix my probleme ???

thank for advance

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

    You are doing a division operation in your SQL which means there is high chance of getting a fractional data as output.

 

count(ACCOUNT.ACCOUNT_ID)*(100/48) as pourcentage  

 So could you please add String as datatype from tOracleInput itself and print the output to tLogrow? If fractional values are coming, you need to take the floor or ceiling of the data and then convert them to integer using tConvertType component.

 

This could be a major reason for your issue. Could you please try and let us know the results?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

9 Replies
Anonymous
Not applicable
Author

Here i add the capture to understood more my query 


tempsnip.png
Anonymous
Not applicable
Author

Hi,

 

    You are fetching integer values like count in your query. But in your schema, the data type seems to be in String format. Could you please change them also to Integer and it should work fine.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

Hello @nthampi,thanks to take your time for me.

I fix the issue on the schema like you sugger me but i have already the same mistake.

I do the same schema with interger only both tDBrow and tLogRow.

See more on the attached files.

If someone can help me to run my program and undestand why i get the same error when according the change them to integer ???

Thanks

 


2.PNG
1.PNG
Anonymous
Not applicable
Author

Hi,

 

    Could you please double check the schema in tLogrow? I believe you must not have used Sync columns button in tLogrow. So the previous schema containing String is still there.

 

     The best thing is delete the problematic subjob and creating it again fresh. So if you have accidently created any wrong data types, it will be corrected.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

Hello @nthampi, find the schema in tlogrow on the file.

Else tell me if my schema is correct also.

I synchonize both schema, normally actually when i running it must work but it's not a case.

When i do mistake ???

Thanks for advance


3.PNG
Anonymous
Not applicable
Author

Hi,

 

   I suspect account_id is creating some problem. So lets do one thing. Why don't you add one column at a time and run the job again? 

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

Hello @nthampi,

I have the sql query below and i want  to create a tLogRow or tfileoutputdelimeted to visualize the result of output query.

select CUSTOMER.CUST_ID,CUSTOMER.CUST_TYPE_CD as type_de_client,
CUSTOMER.ADDRESS as adresse_clients,
count(account.account_id) as nombre_de_client, 
count(ACCOUNT.ACCOUNT_ID)*(100/48) as pourcentage  
from account
left join customer on CUSTOMER.CUST_ID = account.cust_id
left join product on PRODUCT.PRODUCT_CD = ACCOUNT.PRODUCT_CD
where ACCOUNT.AVAIL_BALANCE <= 1000 and PRODUCT.PRODUCT_TYPE_CD = 'LOAN'
group by CUSTOMER.CUST_ID,CUSTOMER.ADDRESS, CUSTOMER.CUST_TYPE_CD

I am trying to built some issues but anything doesn't work like show my attached file.

I want to ask you @nthampi or someone else if you have idea how i can do it using my sql query giving above ???? 


6.PNG
Anonymous
Not applicable
Author

Any help please ????

Anonymous
Not applicable
Author

Hi,

 

    You are doing a division operation in your SQL which means there is high chance of getting a fractional data as output.

 

count(ACCOUNT.ACCOUNT_ID)*(100/48) as pourcentage  

 So could you please add String as datatype from tOracleInput itself and print the output to tLogrow? If fractional values are coming, you need to take the floor or ceiling of the data and then convert them to integer using tConvertType component.

 

This could be a major reason for your issue. Could you please try and let us know the results?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂