oracle SQL 错误:ORA-00906:缺少左括号 00906. 00000 - “缺少左括号”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8424456/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:29:31  来源:igfitidea点击:

SQL Error: ORA-00906: missing left parenthesis 00906. 00000 - "missing left parenthesis"

sqldatabaseoracle

提问by Jatinder Singh

CREATE TABLE customer(customer_id NUMBER(6) PRIMARY KEY
, customer_name VARCHAR2(40) NOT NULL
, customer_address VARCHAR2(60) NOT NULL
, customer_email VARCHAR2(35)
, customer_number NUMBER (11) NOT NULL CHECK LENGTH(customer_number) = 11)

This is just taking the mick I don't understand what is wrong

这只是拿麦克风我不明白有什么问题

回答by chris

You're not specifying a constraint name, and I believe that you need to have the check constraint in brackets:

您没有指定约束名称,我相信您需要在括号中包含检查约束:

, customer_number NUMBER (11) NOT NULL 
  constraint custnumlen CHECK (LENGTH(customer_number) = 11))

Take a look at http://www.techonthenet.com/oracle/check.php

看看http://www.techonthenet.com/oracle/check.php