I want to delete records in the db2 stage in before stage based on the dataset column in the where condition, can you pls any one tell me what is the syntax for this
Quary like in before stage
delete from table_name where column_name=dataset_column_value
Thanks
poduri
how to get dataset column value in before stage
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
Just need a bit more information, are you talking about a DB2 stage as a data source or a destination? Are you trying to perform a replace action on rows?
Try creating a DB2 output stage, select "Replace existing row" as the database update option and then look at the SQL tab, it will show you the SQL statements generated by a replace. There should be a delete followed by an insert. This may be more appropriate place for your delete statement as it will get executed for every row being processed.
The before tab on a DB2 stage is typically run just once per job execution whereas I think you are asking for a delete for each row in the job.
Try creating a DB2 output stage, select "Replace existing row" as the database update option and then look at the SQL tab, it will show you the SQL statements generated by a replace. There should be a delete followed by an insert. This may be more appropriate place for your delete statement as it will get executed for every row being processed.
The before tab on a DB2 stage is typically run just once per job execution whereas I think you are asking for a delete for each row in the job.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
That description suggests that you DO want to use the value in each row to delete from the other table.
I understand from your description that you don't want to commit individual DELETE commands (one per row). This you would need to manage via "rows per transaction" being set to "all" (0), so that all of the generated DELETE statements are treated as a single transaction - that is, no COMMIT is transmitted until all rows have been processed. Make sure that the database server can handle a transaction of this size; it must have the capacity to store the entire set of before-image records (just in case you end up issuing a rollback).
I understand from your description that you don't want to commit individual DELETE commands (one per row). This you would need to manage via "rows per transaction" being set to "all" (0), so that all of the generated DELETE statements are treated as a single transaction - that is, no COMMIT is transmitted until all rows have been processed. Make sure that the database server can handle a transaction of this size; it must have the capacity to store the entire set of before-image records (just in case you end up issuing a rollback).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: