1 Reply Latest reply: Jul 25, 2013 6:42 AM by j i RSS

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

    iTree Consulting

      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.

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

          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.