Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
sona_sa
Creator II
Creator II

Re : Batch file for check the status of SQL / ORACLE

Hi,

Can anybody help me on this :

I want a batch file who can identify the SQL or ORACLE database table/view is updated and after that I can triggered / Schedule my batch file for QlikView raw extractor.

Thanks.

1 Reply
jvitantonio
Specialist III
Specialist III

Hello,

What I do is the following:

1) Once my oracle tables are updated with new data, I create a flag file (txt file) in a specific location.

2) Every 30 min I run a qvw file that checks if that file has been updated. If the file has been updated, then this QVW execution is successful and I trigger my application .qvw to load on successful completion of the this file (though QMC)

Here's is the code that you should put in a .qvw file that checks if the flag file has been updated:

//Set info variables

LET vScriptStarts          =          NOW();

LET vUser          =          OSUser();

LOAD

          NUM(filetime( 'D:\FilePath\flag_file.log' )) as UpdateDate //loads when was the last time the flag file was updated

AutoGenerate(1);

SET vIntervalLoad          =          00 00:10; //Interval load used to load data Format: DD HH:MM

IF Peek('UpdateDate',0) > '$(vLastUpdate)' THEN

          LET vScriptEnds          =          NOW();

          LET vLastUpdate          =          NUM(NOW());

  //Here the script ends successfully

ELSE

//Will exit script with error (fail)

          LET vLastUpdate          =          NUM(NOW());

           LET vScriptEnds          =          NOW();

          SET ErrorMode = 2;

  LET vErrorCode = $(=o); // This causes an internal error, therefore,

ENDIF

EXIT SCRIPT;

I hope this helps.