SP2-0042:未知命令“ENDD” - 忽略其余行

时间:2015-01-02 12:45:16

标签: bash oracle11g sqlplus

我有调用sqlplus来执行操作的脚本。但是,一旦脚本执行,sqlplus总是返回此错误。

未知命令" ENDD" - 其余的行被忽略。

这是我在脚本中编写的sql:

map=sqlplus -s <<ENDD
$db_connection_string
   SET BLANKLINES ON
   SET VERIFY OFF HEADING OFF ECHO OFF FEEDBACK OFF
   ALTER SESSION SET CURRENT_SCHEMA=$MY_DB;
   select
      TRIM(( select Col1 from tableA where tableB.col2=col2 and  col3 = 100)) ||'#' ||
      TRIM(tableB.col3 )||'#'||
      tableB.col4 ||'#'||
      tableB.col5 ||'#'||
      tableB.col6 ||'#'||
      TRIM(( select tableC.col1 from tableC  WHERE tableC.col2=10050 AND tableC.col4 = 1 and tableC.col3 = tableB.col4)) AS ACT#TNID#INS#DC#CHNL#EXTSYSIDK
   from tableB
   where
      tableB.col3='$evn'
   and rownum <2;
ENDD

1 个答案:

答案 0 :(得分:1)

您错过了command substitution语法:

map=$(sqlplus -s <<ENDD
...
ENDD
)