title: Send mail from package calls .exe
body: <p>we are using a .EXE file that reads .Xml file from a given Directory to send mails ,
  to run this .EXE we use following function</p>
  
  <pre><code>   FUNCTION OSCommand_Run (Command IN STRING)
        RETURN VARCHAR2
     IS
        LANGUAGE JAVA
        NAME 'OSCommand.Run(java.lang.String) return int';
  </code></pre>
  
  <p>and .</p>
  
  <pre><code>       PROCEDURE P_SEND_DB_MAIL (
                               P_FROM               VARCHAR2,
                               P_TO                 VARCHAR2,
                               P_CC                 VARCHAR2,
                               P_BCC                VARCHAR2,
                               P_SUBJECT            VARCHAR2,
                               P_BODY               VARCHAR2)
     AS
  
        V_FILE_NAME   VARCHAR2 (250);
        V_DIR_PATH    VARCHAR2 (250);
        X             VARCHAR2 (2000);
     BEGIN
        SELECT DIRECTORY_PATH
          INTO V_DIR_PATH
          FROM ALL_DIRECTORIES
         WHERE DIRECTORY_NAME = 'DIRECTORY';
  
  
        --this is to generate XML file
        GENERATE_XML ('MAIL_DIR',                  
                      V_FILE_NAME || '.xml',       
                      P_FROM,
                      P_TO,
                      P_CC,
                      P_BCC,
                      P_SUBJECT,
                      P_BODY    
                            );
  
        --calling function to execute .exe
        x :=
           OSCommand_Run (
                 V_DIR_PATH
              || 'SendMail.exe '
              || V_DIR_PATH
              || V_FILE_NAME
              || '.xml');
  
     END;
  </code></pre>
  
  <p>if we called this function in any stored package it doesn't work &amp; not given errors or exception
  and it works fine if we call it between normal (Begin .. End) PL code!!
  is there is any explanation </p>