无法在shell脚本中调用该过程

时间:2015-02-24 07:57:27

标签: oracle shell plsql

我有以下shell脚本注册为主机可执行文件调用一个过程,它将调用oracle中的并发程序,当我提交作业时,它没有并发程序生成,我在其他实例中使用相同的方法之前和它会起作用,不知道我是否遗漏了什么。

 #!/bin/ksh
    #--------------------------------------------------
    # Get the current date
    #--------------------------------------------------
    HISTDATE=`date +"%m%d%y%H%M%S"`

    #--------------------------------------------------
    # Input Paramenters
    #--------------------------------------------------
    APPSPW=${1}
    USERID=${2}
    USERNAME=${3}
    REQID=${4}
    INTERFACE_PATH=${5}
    AS_OF_DATE=${6}
    FILENAME=${7}

    echo "+---------------------------------------------------------------------------+"
    echo "| 1. Get FTP Info"
    echo "+---------------------------------------------------------------------------+"
    echo "Request Id     : " $REQID
    echo "Used Id        : " $USERID
    echo "User Name      : " $USERNAME
    echo "Interface Path : " $INTERFACE_PATH
    echo "As of Date     : " $AS_OF_DATE
    echo "File Name      : " $FILENAME

    if [ -d $INTERFACE_PATH ]; then
        echo "- 1.1 Folder "$INTERFACE_PATH" exists"
    else
        echo "- 1.1 Folder "$INTERFACE_PATH" does not exist"
        exit 1
    fi

    echo "+---------------------------------------------------------------------------+"
    echo "| 2. Check File Exist or Not"
    echo "+---------------------------------------------------------------------------+"
    cd $INTERFACE_PATH

    V_FILENAME="${FILENAME}${AS_OF_DATE}"

    for files in `ls ${V_FILENAME}*`
    do
    echo "File Name      : " $files
    INPUT_FULL_FILENAME="${INTERFACE_PATH}${files}"
    if [ -s $INPUT_FULL_FILENAME ]; then
            echo "File found, now proceed SQL loader"

    sqlplus $APPSPW <<ENDOFSQL
     connect $APPSPW
         SET SERVEROUTPUT ON                                
     DECLARE
       P_ERRBUFF VARCHAR2(4000);
       P_ERRCODE VARCHAR2(100);
       P_FULL_PATH VARCHAR2(400);
       ln_request_id   NUMBER;
       lv_appl_name   VARCHAR2(10) := 'XHGL';
       lvc_sqlloader1 VARCHAR2(30) := 'XHGL_DCASS_STG';
       lv_req_status1  VARCHAR2(1);
       lv_msg          VARCHAR2(1000);
       ln_user_id              NUMBER;
       ln_resp_id              NUMBER;
       ln_resp_appl_id         NUMBER;
     BEGIN

     BEGIN
     SELECT APPLICATION_ID
     INTO ln_resp_appl_id
     FROM FND_APPLICATION
     WHERE APPLICATION_SHORT_NAME = 'XHGL';
     EXCEPTION
         WHEN OTHERS THEN
            dbms_output.put_line('Failed to get ln_resp_appl_id');
     END;

      BEGIN
     SELECT FND_GLOBAL.USER_ID
     INTO ln_user_id
     FROM DUAL;
     END;
     dbms_output.put_line('ln_user_id = ' || ln_user_id);                       
       BEGIN
     SELECT FND_GLOBAL.RESP_ID
     INTO ln_resp_id
     FROM DUAL;
     END;


       P_FULL_PATH := TO_CHAR('${INPUT_FULL_FILENAME}');
        dbms_output.put_line('P_FULL_PATH = ' || P_FULL_PATH);              

    FND_GLOBAL.APPS_INITIALIZE(USER_ID      => ln_user_id,
                                  RESP_ID      => ln_resp_id,
                                  RESP_APPL_ID => ln_resp_appl_id);

    XHGL_DCASS_INBOUND_PKG.SUBMIT_CCMS_STG(   P_ERRBUFF,   P_ERRCODE,   P_FULL_PATH );
     dbms_output.put_line('P_ERRBUFF = ' || P_ERRBUFF);
      dbms_output.put_line('P_ERRCODE = ' || P_ERRCODE);


    END;
    /
    exit
    ENDOFSQL
    fi
    done 
    exit 0

0 个答案:

没有答案