How to run different sql to get data according to

2019-08-30 22:30发布

问题:

I use pentaho kettle 8.2 in Windows 10 and db is Oracle, now i have a requirement and don't know how to realize this function. My requirement is that:

step 1: get data 1 from db;

step 2: get data 2 from different table(sql) according to the field of step 1's data 1;

step 3: update other db according data 2 in step 2.

Step 1 is easy to get data from one db, in step 2, i try to get data based on step 1's output, i use Switch/case to judge step 1's result and then use different SQL script, while module SQL script don't have any output so that i couldn't run step3 to update data.

That's my concern that how can i realize this funcation using kettle.

Does anyone have any solution to realize this function?

Attached screenshot to show my current transformation: Note: SQL script are select statement, based on that, Update SQL script will run update statement.

回答1:

PostSwitch/case module configure as the fllowing screenshot shows.



回答2:

There's a couple different ways to input variables, or input the content of an incoming field into a Table Input step. For example, if you have SQL statements saved in a table, you can read those in during your first Table Input step and then feed those statements directly into another Table Input step. You don't need to do that switch case business with all different possible SQL statements engineered into the transformation.

https://wiki.pentaho.com/display/EAI/Table+Input

Check out the documentation for Table Input step and you'll see there's lots of info and examples on ways to dynamically input statements into Table Input.