sqlplus调用sql脚本执行时报错SP2-0734: unknown command beginning的解决方法

今天在用SHELL脚本调sql文件执行sql语句的时候,发现语句中某个字段为lua表达式的结构,该结构在插入时会导致报错如下,并且插入失败:

SP2-0734: unknown command beginning "local mBas..." - rest of line ignored.
SP2-0734: unknown command beginning "local mPro..." - rest of line ignored.
SP2-0734: unknown command beginning "function i..." - rest of line ignored.
SP2-0734: unknown command beginning "if (_inP1=..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "return _in..." - rest of line ignored.
SP2-0042: unknown command "else" - rest of line ignored.
SP2-0734: unknown command beginning "return _in..." - rest of line ignored.
SP2-0042: unknown command "end" - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0042: unknown command "end" - rest of line ignored.
SP2-0734: unknown command beginning "function t..." - rest of line ignored.
SP2-0734: unknown command beginning "if ( _inP4..." - rest of line ignored.
SP2-0734: unknown command beginning "return _in..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0042: unknown command "else" - rest of line ignored.
SP2-0734: unknown command beginning "return _in..." - rest of line ignored.
SP2-0042: unknown command "end" - rest of line ignored.
SP2-0042: unknown command "end" - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "local mPro..." - rest of line ignored.
SP2-0734: unknown command beginning "function g..." - rest of line ignored.
SP2-0734: unknown command beginning "if mstart_..." - rest of line ignored.
SP2-0734: unknown command beginning "return mPr..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP


解决办法:

1、将sql文件的语句中的所有中文注释改为英文注释;

2、sql文件开头使用set sqlblanklines on,这是因为有空行导致sql语句加载到机器内存中截断了。

你可能感兴趣的:(ORACLE数据库)