cancel
Showing results for 
Search instead for 
Did you mean: 

Need to read BODS repository for job information

lakshminarasimhan_n4
Active Contributor
0 Kudos

In my BODS job, I need to read the last successful run of that job, to get the last succesful run  timestamp information. How can we achieve this in BODS job? 

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

MarcusZwirner
Product and Topic Expert
Product and Topic Expert

The history of job runs are stored in the repository table AL_HISTORY.

To select the timestamp (start time) of the last successful run of a job you can use the following select statement:

SELECT MAX(START_TIME) FROM [$GV_RUNTIME_REPO_NAME].AL_HISTORY WHERE STATUS = 'D' AND SERVICE = '[job_name()]'

(status 'D' stands for "success")

If you're using the select statement in a script by using the sql function (e.g. to store the selected timestamp in a variable), you have to escape the quotes in the following way:

SELECT MAX(START_TIME) FROM [$GV_RUNTIME_REPO_NAME].AL_HISTORY WHERE STATUS = \'D\' AND SERVICE = \'[job_name()]\'

Best regards

Marcus