1 Reply Latest reply: Jul 25, 2013 6:42 AM by Juan Vitantonio RSS

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

    iTree Consulting



      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.



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



          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();



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



          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


          //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,



          EXIT SCRIPT;


          I hope this helps.