I am trying to create a SQL table, but I keep getting this error.
Error report -
ORA-00902: invalid datatype
00902. 00000 - "invalid datatype"
Here is my code.
CREATE TABLE viewers
(
user_id SEQUENCE PRIMARY KEY,
first_name VARCHAR2(30),
last_name VARCHAR2(40) NOT NULL,
email VARCHAR2(40) CHECK(LENGTH(email) > 8),
DOB DATE,
CONSTRAINT contact_email UNIQUE (email)
);
CREATE SEQUENCE user_id_seq
START WITH 100000 INCREMENT BY 1
MINVALUE 100000 MAXVALUE 999999;
Your intention is correct but the usage syntactically is not.
You need to create the sequence as first step,