ITPub博客

首页 > 数据库 > Oracle > [20230508]ORA-00907 missing right parenthesis.txt

[20230508]ORA-00907 missing right parenthesis.txt

原创 Oracle 作者:lfree 时间:2023-05-08 08:54:41 0 删除 编辑

[20230508]ORA-00907 missing right parenthesis.txt

--//链接 logic.edchen.org/how-to-resolve-ora-00907-missing-right-parenthesis/,重复测试:

1.环境:
SCOTT@book> @ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.测试:

SCOTT@book> create table fruits (fruit_name varchar2(20), price number not null default 20);
create table fruits (fruit_name varchar2(20), price number not null default 20)
                                                                    *
ERROR at line 1:
ORA-00907: missing right parenthesis

--//不能不讲,给出的错误提示非常让人迷惑,作者给出的解析:

Please note that, the right parenthesis is also known as right round bracket. In CREATE TABLE statement, what
parenthesis encloses is the column list.

In this case, DEFAULT is a valid reserved keyword, but it should be appeared before NOT NULL, not after. So we should
rearrange the order of clauses in the statement to correct the problem.

--//修改为default在前面:

SCOTT@book> create table fruits (fruit_name varchar2(20), price number default 20 not null);
Table created.

--//SCOTT@book> drop table fruits purge;
--//Table dropped.




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2950565/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7970810