Reputation: 402
I am trying to create a table in my db, so I run this:
CREATE TABLE SP
(
SP_ID NUMBER(15,0) primary key,
SP_BEZ VARCHAR2(20 CHAR) not null,
SP ADD SP_BEZLANG varchar2(200),
SP ADD SP_CODE varchar2(30),
SP_ERTS TIMESTAMP(6) DEFAULT SYSTIMESTAMP not null
);
But it comes out as:
ORA-00902: invalid datatype
00902. 00000 - "invalid datatype"
*Cause:
*Action:
I know that oracle does not support booleans, which is something I found out while googling for this problem, but this does not contain any, it's pretty short too.
Anyone see anything wrong with my create statement? Thanks.
Database is Oracle 11g express edition.
Upvotes: 0
Views: 797
Reputation: 93
For creating table in oracle you can go through this documentation :
https://docs.oracle.com/cd/B28359_01/server.111/b28310/tables003.htm#ADMIN11004
In your case problem is you should create table in this way:
CREATE TABLE SP
( SP_ID NUMBER(15,0) primary key,
SP_BEZ VARCHAR2(20) not null,
SP_BEZLANG varchar2(200),
SP_CODE varchar2(30),
SP_ERTS TIMESTAMP(6) DEFAULT SYSTIMESTAMP not null
);
Upvotes: 0
Reputation: 7376
'SP ADD' is not working because 'ADD' is not datatype
CREATE TABLE SP
(
SP_ID NUMBER(15,0) primary key,
SP_BEZ VARCHAR2(20 CHAR) not null,
SP_BEZLANG varchar2(200),
SP_CODE varchar2(30),
SP_ERTS TIMESTAMP(6) DEFAULT SYSTIMESTAMP not null
);
Upvotes: 2
Reputation: 58774
You have extra 'SP ADD', This's working:
CREATE TABLE SP
(
SP_ID NUMBER(15,0) primary key,
SP_BEZ VARCHAR2(20 CHAR) not null,
SP_BEZLANG varchar2(200),
SP_CODE varchar2(30),
SP_ERTS TIMESTAMP(6) DEFAULT SYSTIMESTAMP not null
);
Upvotes: 1