marcuthh
marcuthh

Reputation: 596

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:

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'. That would mean on the actual create statement itself, rather than any of the data dictionary. I don't understand how this can be causing the invalid data type error.

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:
*Action:

Thanks, Mark

Upvotes: 3

Views: 15941

Answers (1)

Atilla Ozgur
Atilla Ozgur

Reputation: 14701

Change SmokerStatus from BOOLEAN to char(1). Oracle does not have boolean data type . You need to use char(1) or number(1) for this purpose.

SmokerStatus char(1),

Upvotes: 9

Related Questions