How to run batch file using trigger?

Hi, i am trying run a batch file using a trigger on a table.
say i have a table XYZ(col_1 varchar2 primary key, col_2 varchar2)
the values of col_2 keeps changing and col_1 are constant
whenever the value of col_2 in any row changes from "on" to "off" i want to run a batch file C:\Users\ABC\Desktop\test.bat
i did some searching but couldn't find any solution. Thanks in advance
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

>
the script will be started around 60-70 times a day
>
No - as marwim said the script will be executed every time the trigger is fired. And that trigger, depending on how it is written, might be fired several times for the same transaction.
And if the trigger is fired the script will be executed even if the transaction that caused the trigger to fire issues a ROLLBACK.
Triggers are non-transactional. You need to clearly define the business rules for when the script should run. Should it run only when the transaction is COMMITTED? Or should it run if the transaction executes even if the transaction performs a ROLLBACK?
A trigger is the wrong solution for your problem.
Please clarify what the business rules are that should control the execution of the script.

Similar Messages

  • How to run batch file from oracle forms 9i

    Hi everyone.
    i have a data in csv file. i want to upload it to my database. i am using sql loader for it.
    i have made a batch file which run the sql loader and transfer my data to database.
    How to run batch file from oracle forms 9i.
    when i press the button, nothing uploads in my database. (when i simply run the batch file it works).
    here is my code
    Begin
    HOST('C:\temp\batchfile.bat');
    message('done');
    end;
    Thanks in advance
    regards
    sajid

    this is my log file, when i run manually.
    SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jul 1 23:27:53 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Control File: file_to_upload.ctl
    There are 2 data files:
    Data File: sk.csv
    Bad File: sk.bad
    Discard File: none specified
    (Allow all discards)
    Data File: sk1.csv
    Bad File: sk1.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table KHAN, loaded from every logical record.
    Insert option in effect for this table: APPEND
    Column Name Position Len Term Encl Datatype
    SR FIRST * , O(") CHARACTER
    DATES NEXT * , O(") CHARACTER
    AGENT NEXT * , O(") CHARACTER
    COUNTRY NEXT * , O(") CHARACTER
    TRANSACTIONS NEXT * , O(") CHARACTER
    PKR NEXT * , O(") CHARACTER
    USD NEXT * , O(") CHARACTER
    BANK NEXT * , O(") CHARACTER
    Table KHAN:
    11088 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 132096 bytes(64 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 11088
    Total logical records rejected: 0
    Total logical records discarded: 0
    Run began on Thu Jul 01 23:27:53 2010
    Run ended on Thu Jul 01 23:27:54 2010
    Elapsed time was: 00:00:00.63
    CPU time was: 00:00:00.17

  • LabView equivalent to running batch files using the "shell" command (VisualBasic)

    I'm converting a VisualBasic app to LabView and am having trouble figuring out how to run a batch file with LabView.
    The VB code that I'm trying to replicate is:
    'UNLOAD RTX DRIVERS
    Dim ProcessId As Long
    ProcessId = Shell(App.Path + "\UnloadReloadRTX.bat", vbNormalFocus)
    Wait 400
    I haven't found a LabView equivalent to the Shell command. Any suggestions will be appreciated.
    thanks,
    Todd

    It seems as if this question pops up every week. Use the System Exec.vi found under Funtions - Communications palette. It is the equivalent of Shell.
    - tbob
    Inventor of the WORM Global

  • Running batch files using java

    Hi,
    How can i run two batch files in a specified interval(Eg. 1 hour) using java.
    Thanks

    Hi,
    Learn to Use the API.
    import java.io.IOException;
    import java.util.Timer;
    import java.util.TimerTask;
    public class RunBat {
         static void runBatchFiles(String[] batchFiles)
              final String[] files = batchFiles;
              Timer timer = new Timer();
              TimerTask task = new TimerTask()          {               
                   Runtime r = Runtime.getRuntime();               
                   public void run() {
                        for(String command : files)
                             try {
                                  r.exec(command);
                             } catch (IOException e) {                              
                                  e.printStackTrace();
              timer.schedule(task, 1000, 1000*60*60);
         public static void main(String[] args) {
              runBatchFiles(new String[]{"cmd /C start f:/one.bat","cmd /C start f:/two.bat"});
    }Thanks

  • How to Run Batch files from inside Reports.

    Hi All,
    I have 2 questions.
    1) How to change the direction of the reports with Arabic orientation i.e Right to left Change without changing the registry.
    2) How to execute a batch file from report or before execution of the report i.e before opening the report.
    I want to set few environmental variables before opening the report. How do i achieve this?
    Request the forum community to discuss and help me out on this issue.
    Thanks in advance

    Thanks Inol
    Though my report is running NLS variable values given in the batch file is not getting picked.
    Here is my batch file contents. My NLS Variables are not getting picked in the reports. I want that to be picked up and the reports orientation should change automatically as per the NLS variables given in the batch file.
    Please go through my batch file code.
    set NLS_LANG                   = AMERICAN_AMERICA.UTF8
    set NLS_CALENDAR            = GREGORIAN
    set NLS_DATE_FORMAT      = dd/MON/yyyy
    set FORMS60_PATH           =   <Enter Relevant Path>
    set REPORTS60_PATH        =  <Enter Relevant Path>
    set PATH=%PATH%;c:\forms6i\bin
    set ORACLE_HOME             =   c:\forms6i
    set TNS_ADMIN                 =   c:\forms6i\NET80\ADMIN\TNSNAMES.ORA
    rwrun60.exe d:\DOTNETORION17_bin\elist_rg1.rdf userid=scott/tiger@thai P1=10Please help me out in getting this value picked and run the report.

  • How to run .exe files using SAP

    Hi,
    How can I run my .exe files using ABAP/4 language? How can I pass parameters to my executable? Is there any documentation related with my question?
    Thanks.

    Here is how you can run a .exe from your ABAP.  I don't know how you would pass parameters.
    report zrich_0001
           no standard page heading
           line-size 300.
    data:
               ifile_table type table of file_table,
               xfile_table type file_table,
                return type i..
    parameters: p_app type file_table-filename
              default 'C:'.
    at selection-screen on value-request for p_app.
      clear ifile_table.  refresh ifile_table.
      call method cl_gui_frontend_services=>file_open_dialog
       exporting
          window_title       = 'Get App'
          multiselection     = space
       changing
          file_table         = ifile_table
          rc                 = return
       exceptions
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          others                  = 4.
      read table ifile_table into xfile_table index 1.
      if sy-subrc  = 0.
        p_app = xfile_table.
      endif.
    start-of-selection.
      data: app type string.
      app = p_app.
      call method cl_gui_frontend_services=>execute
        exporting
          application            =  app.
    Regards,
    Rich Heilman

  • How to run batch files in the backround ??????

    please anyone tell me how to run the batch files in the background i dont want anyone to interfere the batch file..The batch file has to run for a long time even days so it will be safe if the batch file is running in the bachgroung somewhere ..
    please help me in this regards
    Thanking u
    Regards
    Santhosh

    The easiest way is to write a native application which starts the batch file in hidden mode (the target batch file could be an argument).
    Under Windows it would be done with the API call
    ShellExecute(NULL, "open", "C:\mybatch.bat", NULL, NULL, SW_HIDE);
    Then compile the native tool as windows application with no user interface. Now you are able to execute applications in invisible mode.

  • How to run exe files using peoplecode?

    How to run .exe extension files using peoplecode. It should execute on clicking a button.can anyone provide sample peoplecode for the same.
    where do i place the exe files ? Local workstation or Server or FTP?
    can i use the same peoplecode if i'm using a button on grid.

    1. You can use function Exec in PeopleCode to run any exe file
    2. You can use ViewContentURL function in PeopleCode to view any .pdf or .doc documents
    Jayaprakash Tedla

  • Run Batch file using GPO in all users with Windows 2008 R2

    Dear Sir,
    We have to install one software packages in all laptops using GPO. we have batch file and using this we can install software.
    is there any way to install automatic by this batch file?
    this is not msi packages.
    Regards,
    Sunil 
    SUNIL PATEL SYSTEM ADMINISTRATOR

    > Please provide how to configure...
    https://technet.microsoft.com/en-us/magazine/dd630947.aspx
    https://technet.microsoft.com/library/cc779329.aspx
    Greetings/Grüße,
    Martin
    Mal ein
    gutes Buch über GPOs lesen?
    Good or bad GPOs? - my blog…
    And if IT bothers me -
    coke bottle design refreshment (-:

  • Problem wiht Running Batch File using Runtime.exec()

    I am writting one program which will create a jar file using a windows Batch file.
    The main program is in the folder "d:\CmdExec.java".
    The other one to which a jar file to be created is in the folder "e:\folder\HelloWorld.class"
    The contents inside the "e:\folder" are
    e:\folder\HelloWorld.class
    e:\folder\mainClass.txt
    e:\folder\run.bat
    The mainClass.txt contains "Main-Class: HelloWorld"
    The Run.bat file contains "jar cmf mainClass.txt HelloWorld.jar *.class"
    The coding for CmdExec.java is as follows
    import java.io.*;
    import java.awt.Desktop;
    public class CmdExec {
    public static void main(String argv[]) {
    try {
    Desktop desktop = null;
    if (Desktop.isDesktopSupported()) {
    desktop = Desktop.getDesktop();
    desktop.open(new File("e:\\folder\\run.bat"));
    catch (Exception err) {
    err.printStackTrace();
    When i double click the file e:\folder\Run.bat, it will create a jar file for HelloWorld.class.
    But, i want to create that jar file using the java program CmdExec.java.
    When i run CmdExec.java, the batch file is opened. But it shows error as "Can't find the specified file"
    But when i copy the following files to "d:\",
    e:\folder\HelloWorld.class
    e:\folder\mainClass.txt
    the jar file is created using the CmdExec.java.
    But,
    e:\folder\HelloWorld.class
    e:\folder\mainClass.txt
    these files should be in the folder"e:\folder" only.
    Can anyone Help me this Problem?
    Or Anyother way for creating a jar file for one program by using another program?
    Help me soon.............

    Try this. It's not running a bat file. You can say it almost is a bat file.
    import java.io.*;
    import java.util.Scanner;
    public class CmdExec {
        public static void main(String argv[]) {
            try {
                Process p = Runtime.getRuntime().exec("jar cmf mainClass.txt HelloWorld.jar *.class");
                Scanner s1=new Scanner(new InputStreamReader(p.getInputStream()));
                while(s1.hasNextLine())
                    System.out.println(s1.nextLine());
                p.waitFor();
                System.out.println(p.exitValue());
                if(p.exitValue()==0)
                    System.out.println("Okay");
                else
                    System.out.println("Error");
            catch (Exception ex) {
                ex.printStackTrace();
    }Run it in the same folder as mainClass.txt
    Edited by: ColacX on Aug 1, 2008 10:35 AM

  • How to run exe file using oracles procedure (ASAP) ?

    i am finding difficulties in running an exe file using an oracle procedure.I need this for a pure .NET application

    I want the solution for both,An Oracle stored procedure cannot generally run an executable on the client machine. Stored procedures run on the server and have no access to your client machine. You could potentially do something convoluted like run a web server on the client with an ASP page that called the executable and have the stored procedure make a UTL_HTTP call to the ASP page, but that's generally not an option.
    If the executable is on the server and it's only available as an executable, you could write a Java stored procedure that called out to the command line and invoked the executable (assuming the operating system user running the Oracle database has permission to do so). If the Oracle database is on Windows and you've got 10.2, you may also be able to write a .Net stored procedure that would do the same sort of thing.
    If you can expose the functionality as a DLL, a more elegant solution would be to use an external procedure.
    Justin

  • How to run batch programs using SUBMIT command without any interaction need

    Hello ABAP gurus,
    I have created a batch program in SE38 which calls many other SE38 Programs (Reports).
    I have used the command SUBMIT to call the sub programs. There are about 15 sub programs that this main batch program is calling.
    It works fine, but after calling each subprogram it stops and I have to manually click on 'Back Button' in green on the sap screen to run the next program in the list. Like this I have to do 15 times to run all the programs in the batch.
    Is there a way to avoid this manual intervention and make the program run all the sub programs on its own.
    Your feedback will be highly appreciated.
    Thanks
    Ram

    Thanks Sampath for the response.
    Yes I am using the option "AND RETURN". So it is coming out of each sub program, and it is at this stage it waits for me to click on 'backward green arrow' to continue to the next.
    Here is the code I have used
      SUBMIT Z_AS_BI_F0005_EXTRACT WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_DIVISION_EXTRACT WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_COMPANY_EXTRACT WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_CUSTOMER_EXTRACT WITH  S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_BRANCH_EXTRACT WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_BUS_UNIT_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_ADDRESS_EXTRACT WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_CUSTOMER_GROUP_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_GROUP_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_PMT_TERMS_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_REGION_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
      SUBMIT Z_AS_BI_TERRITORY_EXTRACT  WITH S_DATE IN S_DATE WITH P_TEST = 'N' AND RETURN.
    Any other suggestions or feedback will be appreciated.
    Tks
    Ram

  • How to run war file using oc4j

    hi to all..
    i'm new to oc4j .. i used to work on tomcat..
    i deployed the war file and all i have to do is to run the app. but i guess oc4j has different way in this ..
    you may say google for it, or read the oc4j tutorial i read it before but i just can't understand it..
    somebody pls can expalin the way simply...

    as i understood from the site:
    that there's three enviorment variables to be created :
    JAVA_HOME, ORACLE_HOME, (web-app-name)_HOME
    i created them, and started oc4j container correctly...
    after that i understand that i should go the explorer and reach the app at its root and the index.html will work (or the sat welcome-file page)
    and i'm trying that but it's just not working...
    the next error is appearing ...
    2007-07-26 11:28:23.453 NOTIFICATION  J2EE JSP-0008 Unable to dispatch JSP Page
    : Exception:oracle.jsp.parse.JspParseException: /Timing/timesheetmain.js
    p: Line # 4, <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    Error: "http://java.sun.com/jsf/html" is not a registered TLD namespace.am really confused and i need to work it today, my manager wants the project tomorrow..

  • How to run a batch file using tigger....

    Hi, i am trying run a batch file using a trigger on a table.
    say i have a table XYZ(col_1 varchar2 primary key, col_2 varchar2)
    the values of col_2 keeps changing and col_1 are constant
    whenever the value of col_2 in any row changes from "on" to "off" i want to run a batch file C:\Users\ABC\Desktop\test.bat
    i did some searching but couldn't find any solution. Thanks in advance
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    sorry wrong foum to post.
    will post in the correct one
    how to run batch file using trigger?

    Hallo,
    welcome to the forum.
    This is the forum for the tool {forum:id=260}. Your question should be placed in {forum:id=75} or {forum:id=61}.
    When you post your question there please provide additional information like db version, what kind of trigger you want to use, how you want to prevent the execution when the transaction is rolled back... {message:id=9360002}
    Regards
    Marcus

  • How to run a batch file using DAC

    Gurus,
    Please suggest if there is a way to run .bat files using DAC ? I suppose it can be done by configuring Execution Type as External Program. Please suggest how can this be achieved.
    Thanks

    I performed the same steps given in the link and ran the ex plan, but the task shows running and never completes. In my case i have created bat file for a different purpose (not for purging cache).
    Is the path shown in Step 5 the default path or it can be any path ? Please suggest.
    Thanks

Maybe you are looking for