简体   繁体   English

ORACLE SQL-创建表时的数据类型无效

[英]ORACLE SQL - invalid data type on table creation

I am trying to set up a table in an ORACLE database and am getting an invalid data type error when I try to run this command: 我试图在ORACLE数据库中建立表,并且在尝试运行此命令时遇到invalid data type错误:

CREATE TABLE Students (
StudentID NUMBER(8) NOT NULL,
FirstName VARCHAR(25) NOT NULL,
Surname VARCHAR(25) NOT NULL,
Address VARCHAR(100) NOT NULL,
Postcode VARCHAR(7) NOT NULL,
DoB DATE NOT NULL,
Gender VARCHAR(1) NOT NULL,
StudentCategory VARCHAR(50),
StudyType VARCHAR(20),
Nationality VARCHAR(20),
SmokerStatus BOOLEAN,
SpecialNeeds VARCHAR(30),
Comments VARCHAR(30),
PlacedStatus BOOLEAN,
CourseID NUMBER(6) NOT NULL,
AdvisorOfStudies NUMBER(6) NOT NULL,
NextOfKin NUMBER(8) NOT NULL
);

According to the error message, something is occuring 'starting on line 1'. 根据错误消息,正在发生“从第1行开始”。 That would mean on the actual create statement itself, rather than any of the data dictionary. 那将意味着实际的create语句本身,而不是任何数据字典。 I don't understand how this can be causing the invalid data type error. 我不明白这怎么可能导致invalid data type错误。

If anyone can spot what might be causing this, that'd be greatly appreciated! 如果任何人都可以发现可能导致这种情况的原因,将不胜感激!

Error Details: 错误详情:

Error report - SQL Error: ORA-00902: invalid datatype 00902. 00000 - "invalid datatype" *Cause: 错误报告-SQL错误:ORA-00902:无效的数据类型00902。00000-“无效的数据类型” *原因:
*Action: *行动:

Thanks, Mark 谢谢马克

Change SmokerStatus from BOOLEAN to char(1). 将SmokerStatus从BOOLEAN更改为char(1)。 Oracle does not have boolean data type . Oracle没有布尔数据类型 You need to use char(1) or number(1) for this purpose. 为此,您需要使用char(1)或number(1)。

SmokerStatus char(1),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM