A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
Oracle equivalent of MySQLs "enum"?
Joined: Sep 10, 2004
Sep 10, 2004 03:05:00
Hi, does anyone know the Oracle equivalent of MySQLs "enum"? I have an enum like ENUM('yes', 'no', 'undecided').
Joined: Aug 15, 2004
Sep 10, 2004 06:03:00
may be in 10g they added ENUM kind of thing. not sure i haven't come across ENUM in oracle 10g even. dont have much resource to refer for ORACLE 10g by now. but i have 3 solutions for you here:
associate a check constraint to that column.
if you ent to change the list you have to drop the constraint and then create it again, right.
you can have two create/replace triggers
it would be a bit slow in response. performance issue. but it will save you from droping the constraint and creating it again, right.
you can have a table in your DB. you can say a reference table like,
STATUS_ID STATUS_NAME 0 valid 1 invalid 2 active 3 inactive
According to my perception 3rd one is better relatively. i used to do like this.
It is sorta covered in the
JavaRanch Style Guide
subject: Oracle equivalent of MySQLs "enum"?
Oracle OCP equivalent in IBM DB2
Error:Cannot create JDBC driver of class '' for connect URL 'null'
How to define constants for several classes?
20,000 ~ 30,000 rows Insert
retrieve enumeration datatype into jsp
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015