Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i add a column in oracle with Enum values?

Tags:

sql

enums

oracle

How to use enums in Oracle?

The above post gives me an option to create a Enum column while creating a table. But I have a table that is having values. I wanted to add another column with Enum values.

ALTER TABLE CARS **(ADD** BODY_TYPE VARCHAR2(20) 
                    CHECK (BODY_TYPE IN ('COUPE','SEDAN','SUV')) );

I'am getting a syntax error near ADD. Please guide.

like image 809
Jess Avatar asked Sep 19 '13 20:09

Jess


1 Answers

Place "add" before "(".

alter table cars
add
(
  body_type varchar2(20) not null check (body_type in ('COUPE','SEDAN','SUV'))
);
like image 103
Tomasz Żuk Avatar answered Nov 01 '22 21:11

Tomasz Żuk