当前位置: 代码迷 >> Oracle管理 >> ORA-00984: 列在此处不允许 创建表时遇到的有关问题
  详细解决方案

ORA-00984: 列在此处不允许 创建表时遇到的有关问题

热度:749   发布时间:2016-04-24 06:22:00.0
ORA-00984: 列在此处不允许 创建表时遇到的问题
SQL code
CREATE TABLE SubAccount 
(
  AccountName  VARCHAR2(20)                    NOT NULL,
  AccountPwd    VARCHAR2(100)                  NOT NULL,
  AccessIP1    VARCHAR2(20),
  AccessIP2    VARCHAR2(20),
  CompanyName  VARCHAR2(100)                  NOT NULL,
  ContactName  VARCHAR2(20),
  Contact      VARCHAR2(20),
  Province      VARCHAR2(40),
  City          VARCHAR2(40),
  NumberBelong  VARCHAR2(30),
  AccountTime  DATE                            DEFAULT sysdate              NOT NULL,
  DisableTime  DATE,
  UserStatus    CHAR(1)                        DEFAULT U                    NOT NULL,
  Remark        VARCHAR2(200)
)
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
NOMONITORING;

COMMENT ON COLUMN SubAccount.AccountName IS '子平台帐号';

COMMENT ON COLUMN SubAccount.AccountPwd IS '接入方密码';

COMMENT ON COLUMN SubAccount.AccessIP1 IS '接入方ip1';

COMMENT ON COLUMN SubAccount.AccessIP2 IS '接入方ip2';

COMMENT ON COLUMN SubAccount.CompanyName IS '企业名称';

COMMENT ON COLUMN SubAccount.ContactName IS '联系人';

COMMENT ON COLUMN SubAccount.Contact IS '联系方式';

COMMENT ON COLUMN SubAccount.Province IS '省份';

COMMENT ON COLUMN SubAccount.City IS '城市';

COMMENT ON COLUMN SubAccount.NumberBelong IS '归属地';

COMMENT ON COLUMN SubAccount.AccountTime IS '开户时间';

COMMENT ON COLUMN SubAccount.DisableTime IS '停用时间';

COMMENT ON COLUMN SubAccount.UserStatus IS '用户状态';

COMMENT ON COLUMN SubAccount.Remark IS '备注';


ALTER TABLE SubAccount ADD (  CONSTRAINT SubAccount_PK PRIMARY KEY (AccountName));


------解决方案--------------------
--缺省值字符加上单引号
CREATE TABLE SubAccount
(
AccountName VARCHAR2(20) NOT NULL,
AccountPwd VARCHAR2(100) NOT NULL,
AccessIP1 VARCHAR2(20),
AccessIP2 VARCHAR2(20),
CompanyName VARCHAR2(100) NOT NULL,
ContactName VARCHAR2(20),
Contact VARCHAR2(20),
Province VARCHAR2(40),
City VARCHAR2(40),
NumberBelong VARCHAR2(30),
AccountTime DATE DEFAULT sysdate NOT NULL,
DisableTime DATE,
UserStatus CHAR(1) DEFAULT 'U' NOT NULL,
Remark VARCHAR2(200)
)
LOGGING 
NOCOMPRESS 
NOCACHE
NOPARALLEL
NOMONITORING;
------解决方案--------------------
UserStatus CHAR(1) DEFAULT U NOT NULL,
U 这里是CHAR,所以必须加‘U’
------解决方案--------------------
出现这个错误肯定是SQL语句写错了,不要怀疑其它如oracle是不是有问题之类