Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I'm new using Talend, and I was trying to use a global variable inside query but it is displaying an error that I couldn't sort it, so then I was wondering if you can suggest me another way to do it or do you know how to sort this issue?
System.out.println("The sample data should be: " + sampleDataround);
//Set SampleDataround as a global variable to be used in next steps...
globalMap.put("sampleData",sampleDataround);
int test = (int)globalMap.get("sampleData");
System.out.println("Sample data value is: "+test);
"SELECT *
FROM " + context.GMIP_INQUIRY_MART_RW_schema + "." + context.GMIP_INQUIRY_TABLES_CASE_TEST + "
order by
random() limit "+globalMap.get("sampleData")+""
Exception in component tDBInput_1 (job_fact_inquiry_cases_a_test)
[FATAL]: seu_gmip_inquiry_raw_mart_load.job_fact_inquiry_cases_a_test_10_3.job_fact_inquiry_cases_a_test - tDBInput_1 [Amazon][JDBC](10140) Error converting value to int.
java.sql.SQL
Hello,
Replace (int)globalMap.get("sampleData") by (Integer)globalMap.get("sampleData").
you can try to display the query in a tJava (on Component Ok ) after GMIP tDBInput.
Hello,
I did, and it's the same failure, I notice if I delete the delimited output component the error goes away, I don't know why that is happening
Hi
Check if you have defined the schema, in addition, replace the global variable with a constant in query to see if you have the same issue.
"SELECT *
FROM " + context.GMIP_INQUIRY_MART_RW_schema + "." + context.GMIP_INQUIRY_TABLES_CASE_TEST + "
order by
random() limit 10"
Regards
Shong