Oracle-SP2-0042: 未知命令 ")" - 其余行忽略。

2020年03月25日 15:38 · 阅读(4701) ·

开发环境

名称 版本
操作系统 Windows 10 X64
Oracle win64_11gR2_database
PLSQL Developer 11.0.4.1788(64 bit)01.179332 - Unlimited user license

问题描述

创建表 sql 如下

  1. --创建表
  2. create table test_v_hwhao1
  3. (
  4. ID varchar2(64) default SYS_GUID() not null,
  5. No varchar2(10),
  6. Name varchar2(10),
  7. Constraint TB_PK_test_v_hwhao1_id Primary key(ID)
  8. );
  9. --表注释
  10. comment on table test_v_hwhao1 is 'test_v_hwhao table';
  11. --字段注释
  12. comment on column test_v_hwhao1.ID is '主键';
  13. comment on column test_v_hwhao1.No is '编号';
  14. comment on column test_v_hwhao1.Name is '名称';

通过 PLSQL Developer 执行没问题,通过 SqlPlus 执行报错

  1. SP2-0042: 未知命令 ")" - 其余行忽略。

问题分析

猜测是英文括号或者文件编码的问题。

问题解决

1.检查了确认括号为英文括号;

2.在 PLSQL Developer 把文件重新另存为 sql 脚本,这一步的目的是让 sql 脚本的文件编码为 PLSQL Developer 默认的文件编码

测试结果

重新执行脚本,执行成功。