DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Executing a program from a trigger!?

  1. #1
    Join Date
    Mar 2001
    Posts
    3

    Question

    Has anybody been able to execute a program on the database server from an Oracle trigger?

    I have a table that when updated the users want a program to execute. I can exeute the program from a command line, but is there a way to get the trigger to execute something from the command line?


  2. #2
    Join Date
    Feb 2001
    Location
    Kolkata- India
    Posts
    356
    If by program you mean executing a pl/sql stored procedure, You can surely do that with exeception that there should not be any commit in the procedure.
    There Nothing You cannot Do, The problem is HOW.

  3. #3
    Join Date
    Feb 2001
    Location
    Paris, France
    Posts
    809
    and if you mean external program, just make a search on this forum about how to call external programs from Oracle, there have been some threads about that )

  4. #4
    Join Date
    Mar 2001
    Posts
    314
    Originally posted by sudip
    If by program you mean executing a pl/sql stored procedure, You can surely do that with exeception that there should not be any commit in the procedure.
    Just an update

    You can have COMMIT statements within a stored procedure called from a trigger in 8i and above. The follownig code snippet is perfectly valid:

    create or replace trigger emptest
    before insert on emp
    for each row
    declare
    PRAGMA AUTONOMOUS_TRANSACTION;
    -- this pragma allows us to have commits!
    begin
    testinsert(:new.empno, :new.ename);
    -- testinsert is the SP containing the COMMIT
    end emptest;

    create or replace procedure Testinsert(empno in number, ename in varchar2) is
    begin
    INSERT INTO TT1 (EMPNO, ENAME) VALUES (empno, ename);
    COMMIT;
    end Testinsert;


    -amar



  5. #5
    Join Date
    Mar 2001
    Posts
    3
    Thanks, but I am looking to run an external program. (ie, cmd.exe, explorer.exe, etc..) Is there a "not so complicated" way to do that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width