Delete DB table
Workshop - Delete DB
Sometimes you might have to delete data from a table. If the operation to do it is simple, for example:
DELETE FROM ORDERS_TABLE WHERE STATUS='Shipped'
Or
DELETE FROM TMP_TABLE
You could simply execute it by using an SQL job entry or an Execute SQL script step. If you face the second of the above situations, you can even use a Truncate table job entry.
For more complex scenarios, you should use the Delete step.
Steel Wheels are launching a campaign, focusing on Customers who have ordered more than 50 of each of their various Productlines.


View the STG_SALES_DATA data.

Execute the following statement.

Drag the CSV File Input step onto the canvas.
Open the CSV File Input properties dialog box.
Ensure the following details are configured, as outlined below:

Double-click on the canvas and select the Parameter tab.
Ensure the following details are configured, as outlined below:

Drag the Get variables step onto the canvas.
Open the Get variables properties dialog box.
Ensure the following details are configured, as outlined below:

Be careful when using the Pentaho Comparators ..!
Ensure you have backed up everything before executing as this action is a destructive change.
Drag the Delete step onto the canvas.
Open the Delete properties dialog box.
Ensure the following details are configured, as outlined below:
The Pentaho comparators are the opposite to SQL..!!

Check the results in the database table.
The Pentaho Comparators may result in unexpected behaviour.
Run the Transformation.
In your DB management tool View the STG_SALES_DATA table.

Last updated
Was this helpful?
