[resolved] Set a SQL result as a global var

One Star

[resolved] Set a SQL result as a global var

Hi everyone,
I would like to get the result of a SQL query (it is a sequence number), and set it as a global variable I could use in several child jobs.
How can I do that (under TOS 3.0.x) ?
Thank you in advance.
Best regards,
Nicolas

Accepted Solutions
Community Manager

Re: [resolved] Set a SQL result as a global var

Hello
In father job, generate the unique number and set it to a global or context var. on tRunjob, pass the value of global or context var to a context var defined in child job.
In child job, define a context var which will be used to receive value on father job.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
One Star

Re: [resolved] Set a SQL result as a global var

Hi,
I do this task by using a tContextLoad componet on exit on tMap component.
Community Manager

Re: [resolved] Set a SQL result as a global var

Hello Nicolas
Do you want to pass a parameter dynamically to child job or pass a fixed one?
I would like to get the result of a SQL query (it is a sequence number)

Please give an example to explain this sentence
Best regardsg
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Set a SQL result as a global var

Hi,
In fact, I want to generate one unique number number each time I launch a job.
It is an occurence generated by a sequence : etl_seq_int_occurence_id.NEXTVAL.
It's useful for some logs.
I would like to keep this value in a global (or context) var.
I will pass this variable in context parameter to some child jobs.
Regards,

Nicolas
Community Manager

Re: [resolved] Set a SQL result as a global var

Hello
In father job, generate the unique number and set it to a global or context var. on tRunjob, pass the value of global or context var to a context var defined in child job.
In child job, define a context var which will be used to receive value on father job.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
One Star

Re: [resolved] Set a SQL result as a global var

Hi Shong,
Thank you.
However, I don't know how to pass my SQL result to a global or context var.
I tried to link an "tOracleInput" to a "tSetGlobalVar" component, but I haven't found how to set the input data as a var, and I haven't found any global var to take my SQL query result.
Best regards,
Nicolas
Community Manager

Re: [resolved] Set a SQL result as a global var

Hello
However, I don't know how to pass my SQL result to a global or context var.

tOracleInput-->tJavaRow(globalMap.put("sequence", input_row.colName)
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Set a SQL result as a global var

Hi again,
Ok, I'm going to try it.
Thank you much Shong.
Best regards,
Nicolas

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download