I am connected to oracle db and I have a query in SQL statement box in the DB reader configuration. It has a month value in the query. The query needs to run every month. So i was wondering instead of searching the month value in the entire query, every month and editing it, is there any way that we can dynamically change it using any place holders/flow variables of such sort.
Thanks in advance.
Sure. I would use flow variable for this purpose. You have couple of options how to implement it. You can create a global flow variable and then change its value each month. You can create local flow variable from String input node and then change it there each month or if you want to have it totally automated use Date&Time Input node with execution time option check. After that using String Manipulation (Variable) node extract your month and feed it into your query.
Thanks for the reply.
I am new to knime and didn’t understand it completely.
my query is like follows:
WHERE ep.snpsht_dt IN last_day(to_date("+ month +",‘MON-YY’))
Normally I would run the query by giving the month value in the specified format. But as I have to pass month values at several places,I was wondering if we can do it dynamically from something like connector node or flow variables. a sample WF would be highly appreciated.
For start on flow variables check this video:
Also check attached workflow example with sqlite database using flow variable and Parameterized Database Query node:
2019_02_26_Flow_Variable_DB.knwf (20.9 KB)
Hope this helps.
Thanks for the help !