SQL * Plus - 假脱机CSV - SP2-0734:未知命令beginnin

时间:2015-05-13 15:46:19

标签: sql oracle sqlplus

当我启动以下任务.cmd:

sqlplus -s User/Password@database @Query.sql 'G:'

我收到此错误:

SP2-0734: unknown command beginnin

即使添加sqlblanklines on集也失败了。

使用select * from table1这样的简单查询就可以了。

使用更复杂的查询(多个连接,分组依据),它不起作用=>即使文件生成良好。在文件中,我只是找到错误的详细信息。

请在下面找到有关该问题的更多详细信息:

SP2-0734: unknown command beginning "FROM NOTI...." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0734: unknown command beginning "INNER JOIN..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "LEFT JOIN ..." - rest of line ignored.
SP2-0734: unknown command beginning "LEFT join ..." - rest of line ignored.
SP2-0734: unknown command beginning "LEFT join ..." - rest of line ignored.
SP2-0734: unknown command beginning "LEFT JOIN ..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "LEFT join ..." - rest of line ignored.
SP2-0734: unknown command beginning "LEFT join ..." - rest of line ignored.
SP2-0734: unknown command beginning "WHERE NOTI..." - rest of line ignored.
SP2-0734: unknown command beginning "GROUP BY N..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning ",table1..." - rest of line ignored.
SP2-0734: unknown command beginning ",table2..." - rest of line ignored.

3 个答案:

答案 0 :(得分:4)

默认情况下,SQL * Plus会处理空行as terminating the previous command

  

SQL语句或脚本中的空行告诉SQL * Plus您已完成输入命令,但不想再运行它。

FROM之前的第一个空白行终止了SELECT - 但是由于最后一行没有分号而且你没有/在下一行。部分SELECT保存在语句缓冲区中,但从未执行过。

SQL * Plus然后尝试解释文件的其余部分,但是因为每个后续行都没有从它识别为SQL的东西开始,并且不是SQL * Plus命令,所以你得到SP2-0044对所有人来说。

您可以删除语句中间的空白行;或者在脚本开头发出SET SQLBLANKLINES ON

  

控制SQL * Plus是否在SQL命令或脚本中放置空行。 ON将空行和新行解释为SQL命令或脚本的一部分。 OFF(默认值)不允许SQL命令或脚本或脚本中出现空行或换行。

答案 1 :(得分:1)

我遇到了同样的问题,即使我尝试了SET SQLBLANKLINES ON但没有运气。我终于弄清楚问题是文件编码格式。实际上我曾经使用visual studio保存我的sql文件,它以utf-8编码格式保存文件。

解决方案 - 在记事本中打开sql文件 - >另存为ANSI编码格式。它有效。

答案 2 :(得分:0)

在我使用cmd脚本运行并将sqlplus结果保存为txt文件的情况下,SET SQLBLANKLINES ON无效。

一旦我在“ PROMPT”注释行和select语句的第一行之间添加了空白行,错误就消失了。以前,我的select语句行紧靠PROMPT行,并且会生成SP2-0734。