小白今天在linux环境刷一个数据库的Precedure,出现了如下报错:

SP2-0042: unknown command "AS" - rest of line ignored.
SP2-0734: unknown command beginning "v_WSJA ..." - rest of line ignored.
SP2-0734: unknown command beginning "v_WSJB..." - rest of line ignored.
SP2-0734: unknown command beginning "v_WSJC..." - rest of line ignored.

SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
  v_wsj_name := 'LISTLOG_' || to_char(sysdate + 1,'yyyymmdd');
  *
ERROR at line 2:
ORA-06550: line 2, column 3:
PLS-00201: identifier 'v_WSJA' must be declared
ORA-06550: line 2, column 3:
PL/SQL: Statement ignored
ORA-06550: line 4, column 3:
PLS-00201: identifier 'v_WSJB' must be declared
ORA-06550: line 4, column 3:
PL/SQL: Statement ignored
ORA-06550: line 6, column 65:
PLS-00201: identifier 'v_WSJC' must be declared
ORA-06550: line 6, column 3:
PL/SQL: Statement ignored

 

小白很着急,来来回回看了sql脚本很多遍,没什么异常,看到第3遍的时候,终于发现了疑点:

--???é?¤?????oè?¨                                    (这是中文注释,但是linux不识别中文,于是成为乱码)
CREATE OR REPLACE PROCEDURE P_WSJ_PRECEDRE
AS
  v_WSJA        VARCHAR2(100);
  v_WSJB     VARCHAR2(2000);
  v_WSJC   VARCHAR2(100);
BEGIN

 

解决办法:

将sql语句中的所有的中文注释全改成英文注释,就可以了。

 

 

总结:

在linux环境刷sql脚本的时候,应该注意两点:

1. sql文本的格式必须是UTF-8 无bom头

2. 没有中文注释

 

GitHub 加速计划 / li / linux-dash
10
2
下载
A beautiful web dashboard for Linux
最近提交(Master分支:1 个月前 )
186a802e added ecosystem file for PM2 5 年前
5def40a3 Add host customization support for the NodeJS version 5 年前
Logo

新一代开源开发者平台 GitCode,通过集成代码托管服务、代码仓库以及可信赖的开源组件库,让开发者可以在云端进行代码托管和开发。旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐