Tuesday 10 July 2012

Select and Delete a Row in single DML- Better job control

Can we Select a row and delete the row in a single SQL?



-----------------------------------------------

---- Select and delete in the same statement---

SELECT AND CONSUME TOP 1 * FROM TA_62917_QRMDB.VERSION_QRM;

How it helps?

1. It becomes an efficient way of maintaining the latest records in the Journal/Control tables of a Batch.

2. Control tables that contain the aggregation job-names, will be processed one by one. So, it helps in dependency control.

RunAggregate.ksh <Aggregate_Name>

where <Aggregate_Name> is taken from

1

TAG_MICR_PAIE

2

TAG_SER_BILLING

3

TAG_MON_BILLING


3. Environments synchronisation can be done using the above query.

Example: If a file is transferred from Mainframe server to UNIX server.
Command : Sendfile.ksh <Filename>
Where <filename> is the output of
SELECT AND CONSUME TOP 1 * FROM TA_62917_QRMDB.VERSION_QRM;

Thus once the file is sent, chances of sending the file again is NIL.

--------------------------------------------------------

No comments:

Post a Comment

Please share your thoughts and let us know the topics you want covered