Reputation: 203
does DB2 support enums? I didn't really find anything online. The Query doesn't work:
create table prototype.test(id int not null primary key, level ENUM('upper', 'lower') not null);
Thanks in advance!
Upvotes: 4
Views: 3798
Reputation: 7693
You can create a check constraint for that.
alter table prototype.test add constraint checklevel check (level in ('upper', 'lower'));
Or you can include this in the create table:
create table prototype.test(
id int not null primary key,
level varchar(5) check (level in ('upper', 'lower')
);
Upvotes: 10
Reputation: 172428
No DB2 does not support ENUMS. The are some database which I am aware of which suports Enums is MySql and Postgresql but DB2 for sure does not support it.
Upvotes: 6