user2828552
user2828552

Reputation: 67

ORA-00902: invalid datatype

I am getting the above error when I run the following query

create table customer (
  cust_fname   varchar2(15) NOT NULL,
  cust_lname   varchar2(15) NOT NULL,
  cust_id      number(9,0) NOT NULL,
  address      varchar2(40) NOT NULL,
  city         varchar2(14) NOT NULL,
  postal_code  number(6,0) NOT NULL,
  country      varchar2(14) NOT NULL,
  phone_no     number(12,0) NOT NULL,
  e-mail       varchar2(30) NOT NULL,
  password     varchar2(10) NOT NULL,
  primary key(cust_id),
  check(e-mail like '_%@_%._%')
);

Please tell what is the problem.

Upvotes: 4

Views: 15475

Answers (1)

MrSimpleMind
MrSimpleMind

Reputation: 8597

e-mail uses a hyphen in field name.

change it to e.g. e_mail or email.

you should not use (hyphen) - in field name.

You could use - but it would not be a smart solution, you would need right quoting each time you query the field/table that uses hypens or other unsupported characters.

Upvotes: 5

Related Questions