Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2003
    Posts
    2

    Unanswered: Executing .BAT file from Oracle Stored Procedure ...

    Hi All,

    How can I call an Oracle MS-DOS batch file from Oracle Stored Proceduer ?

    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    Desk, slightly south of keyboard
    Posts
    697
    Hi Sureshdas,

    Firstly there's no such thing as an "Oracle MS-DOS batch file" only "MS-DOS batch files".

    I guess you would need to write a .dll and call it through ExtProc.

    Hth
    Bill
    Please don't email me directly with questions. I've probably just got home from the pub and cannot guarantee the sanity of my answers. In fact, I can't believe I actually made it home.

  3. #3
    Join Date
    Dec 2003
    Posts
    2
    Guys,


    I need to execute a .BAT file (MS-DOS batch file) from Oracle PL/SQL.

    How to perform this, in Oralce Stored Procedure / Trigger ?


    Thanks

  4. #4
    Join Date
    Nov 2002
    Location
    Desk, slightly south of keyboard
    Posts
    697
    Hi,

    If you go to .....

    http://examples.oreilly.com/oraclep3/individual_files/

    and scroll to the bottom, there are four files (extproc*.*) whos titles suggest they offer some sort of shell processing.

    I haven't looked at them, and unless you have a suitable c compiler you won't be able to build them. Bascically the .dll is core to it.

    Your Pl/sql calls extproc which in turns calls a function within a .dll which does the actuall MS-DOS calls.

    Hth
    Bill
    Please don't email me directly with questions. I've probably just got home from the pub and cannot guarantee the sanity of my answers. In fact, I can't believe I actually made it home.

  5. #5
    Join Date
    Dec 2003
    Posts
    74
    yes you will have to do an external procedure calls. A database link will need to be set up which will allow the you to leave the database and go out onto the O/S. Once on the O/S you can do pretty much anything

  6. #6
    Join Date
    Nov 2002
    Location
    Desk, slightly south of keyboard
    Posts
    697
    I'm not following how a database link comes into this. As I understand it you need to first ensure that extproc is configured to make external dll calls and then create a PL/SQL library which maps PL/SQL functions onto the DLL functions....

    PHP Code:
    CREATE OR REPLACE LIBRARY POINTER_TO_MY_DLL AS 'C:\\ORACLE\\ORA81\\MYDLL.DLL';

    FUNCTION 
    GetCfg RETURN VARCHAR2 IS
       EXTERNAL   LIBRARY POINTER_TO_MY_DLL 
    -- this would be the library ie your dll
       NAME       
    "GetConfig" -- and this would be a function within it which uses the 'c' calling convention
       LANGUAGE   C

    Your external dll can do (nearly) anything, but first you have to write the dll.

    Hth
    Bill
    Please don't email me directly with questions. I've probably just got home from the pub and cannot guarantee the sanity of my answers. In fact, I can't believe I actually made it home.

  7. #7
    Join Date
    Dec 2003
    Posts
    74
    YES APOLOGIES IT'S A LINK NOT A DATABASE LINK SORRY FOR THE CONFUSION

Posting Permissions

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