Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a tOracleInput with the following query
"SELECT * FROM VW_LATEST WHERE "+
DTC_EVENT_ID = "+context.event_id
This is inefficient and needs to be converted to a prepared statement using tOracleRow. However the output from the tOracleInput is a dynamic row. How can I convert from the object in tOracleRow to a dynamic row output?
Not really what I was looking for as it still does the tOracleInput. I resolved it with a tJavaRow and processed the record set rather than the dynamic row.
Hi,
You can pass the output of tDBRow to a tFlowtoIterate component where the column name is called "query". In the tDBInput, use COntrol+Space to get this value under tFlowtoIterate component. When you select it, it will add to query section as shown below.
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
Not really what I was looking for as it still does the tOracleInput. I resolved it with a tJavaRow and processed the record set rather than the dynamic row.
TJavaRow has the following code
java.sql.ResultSet re_tParseRecordSet_3 = (java.sql.ResultSet) row7.dynamicRow;
boolean hasNextRecord_tParseRecordSet_3 = false;
saRowMap = ((java.util.Map<String, Object>)globalMap.get("saRowMap"));
globalMap.put("saRowMap", saRowMap);
int numColumns1 = re_tParseRecordSet_3.getMetaData().getColumnCount();
//System.out.println(numColumns1);
//System.out.println(saRowMap);
hasNextRecord_tParseRecordSet_3 = re_tParseRecordSet_3.next();
for (int i = 1; i < numColumns1 + 1; i++) {
//System.out.println(i);
String colName = re_tParseRecordSet_3.getMetaData().getColumnName(i);
if (!saRowMap.containsKey(colName)) {
Object colVal = re_tParseRecordSet_3.getObject(i);
// System.out.println(colName);
// System.out.println(re_tParseRecordSet_3.getMetaData().getColumnTypeName(i));
if ("DATE".equals(re_tParseRecordSet_3.getMetaData().getColumnTypeName(i)) && colVal != null){
colVal = TalendDate.formatDate("dd/MM/yyyy", (Date) colVal);
// System.out.println(colName);
}
// System.out.println(colVal);
saRowMap.put(colName, colVal);
}
}
RulesEngine.evaluateExpressions(saRowMap,
(List<java.util.Map<String, String>>)context.j902_exprList,
(List<java.util.Map<String, String[]>>)context.j902_paramList);
output_row.EVENT_ID = context.event_id;
output_row.STATUS_ID = 30;
output_row.INPUT_MAP = saRowMap;
output_row.CHANGE_USER = "TALEND";
//System.out.println(output_row);