文件名来自unix的SQL查询输出

时间:2015-06-06 14:28:37

标签: sql oracle unix ksh

我编写了一个简单的import { WS_URL } from "./constants/ws"; import WSActions from "./actions/ws"; class WSClient { constructor() { this.conn = null; } open(token) { this.conn = new WebSocket(WS_URL + "?access_token=" + token); this.conn.onopen = WSActions.onOpen; this.conn.onclose = WSActions.onClose; this.conn.onerror = WSActions.onError; this.conn.addEventListener("action", (payload) => { WSActions.onAction(payload); }); } close() { this.conn.close(); } send(msg) { return this.conn.send(msg); } } export default new WSClient(); 文件来从Oracle SQL中检索数据但是收到错误。以下是我的代码:

sh

我的输出为:

.  $HOME/.profile

function assignVariables
{

    ID="finapp"
    PASS="finapp"
    MAIL_BODY_PATH="/rbluat/BACKEND/Finacle/FC10.2.9/app/CDCI_LOGS/"

}

echo $ID
echo $PASS
function getDatatrans
{

            TRANID=`sqlplus -s $ID/$PASS@rbluat <<EOF
            SELECT DISTINCT TRAN_ID,DTH_INIT_SOL_ID,TRAN_DATE,DEL_FLG FROM TBAADM.DTD WHERE PSTD_FLG='N' AND ENTRY_USER_ID='FIVUSR' and del_flg='N' and tran_date=(select db_stat_date from tbaadm.gct)AND REF_NUM IN (SELECT PYMT_REF_NUM FROM TBAADM.PORD WHERE STATUS IN ('A','H'));
exit;
EOF`
}

assignVariables

getDatatrans
echo $TRANID

`

此处 [YOU HAVE NEW MAIL] SELECT DISTINCT TRAN_ID,DTH_INIT_SOL_ID,TRAN_DATE,DEL_FLG FROM TBAADM.DTD WHERE PSTD_FLG='N' AND ENTRY_USER_ID='FIVUSR' and del_flg='N' and tran_date=(select db_stat_date from tbaadm.gct)AND REF_NUM IN (SELECT PYMT_REF_NUM FROM TBAADM.PORD WHERE STATUS IN ('A','H')) few.sh test.sh ERROR at line 1: ORA-00942: table or view does not exist few.sh是当前工作目录中的文件名。 test.sh是我编写此代码的文件。我不知道这些名字是怎么来的。我在KSH工作。我试着用Google搜索但没有发现任何线索。

1 个答案:

答案 0 :(得分:0)

在命令

中评估sqlplus的输出
echo $TRANID

当TRANID中有*时,ksh会显示它可以找到的文件。 您应该使用引号来避免评估:

echo "$TRANID"

当你编辑代码时,你也可以添加{}(这里不需要,好习惯):

echo "${TRANID}"

同样地:

echo "${ID}"
echo "${PASS}"
...
-s "${ID}/${PASS}@rbluat"