Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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 🙂
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 🙂
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
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 🙂
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 🙂
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 ????
Any help please ????
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 🙂