Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    4

    Red face Unanswered: Calling OS command from PL/SQL ?

    Hello !

    I have a PL/SQL procedure where i want to build
    a operating system command (ex. Solaris) and then want
    to execute them.
    Does anybody knows how to do that ?

    Thank, Mueller

  2. #2
    Join Date
    May 2003
    Location
    France
    Posts
    112

    Re: Calling OS command from PL/SQL ?

    Originally posted by mueller
    Hello !

    I have a PL/SQL procedure where i want to build
    a operating system command (ex. Solaris) and then want
    to execute them.
    Does anybody knows how to do that ?

    Thank, Mueller
    1 configure listener with external proc,(don't forget tnsnames.ora)
    2 compile C library wich accept one parameter (the os command) and call system with
    3 declare a library in your schema

    then you can can call the oracle library in PL/SQL

  3. #3
    Join Date
    Jan 2003
    Location
    Woking
    Posts
    107

    Re: Calling OS command from PL/SQL ?

    Originally posted by ndu35
    1 configure listener with external proc,(don't forget tnsnames.ora)
    2 compile C library wich accept one parameter (the os command) and call system with
    3 declare a library in your schema

    then you can can call the oracle library in PL/SQL

    Hi,
    Same thing in much more detail

    -----------------------------------------------------------------
    create library lib_mtb is '/home/sendhost.o'

    CREATE OR REPLACE PROCEDURE PR_SHELL(cmd IN VARCHAR2)
    AS EXTERNAL
    NAME "sendhost" --function name in c file
    LIBRARY lib_mtb --Library name
    LANGUAGE C
    PARAMETERS(cmd string);
    /

    To Create sendhost.o
    --------------------
    The code will be like <File Name = sendhost.c>
    #include<stdio.h>
    int i;
    int sh(char *cmd)
    {
    i = system(*cmd);
    return i;
    }

    Compile this into a dll file
    /usr/bin/cc -G sendhost.c


    Final PL/SQL Call would be

    PR_SHELL('/tmp/any_executable');


    Hope it Helps.
    nn

Posting Permissions

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