Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a simple Oracle database (non SDE/Geodatabase) but I want to constrain the values that can be entered into a particular field (ex: the state names that can be stored/entered in a "State" field)

This is exactly what Domains are, in an ESRI geodatabase. Does something like this exist outside of Geodatabases? If so, how can I do it?

share|improve this question
    
first oracle does support domain values, second does the software you are going to use recognize those? –  Brad Nesom May 30 '11 at 7:41
    
have a look at check constraints, foreign key constraints, triggers. –  Jay Cummins May 30 '11 at 10:48
add comment

3 Answers

You can try writing triggers for the database, checking for valid values (trigger restriction) and update the field accordingly. Check the following links:
Parts of a Trigger
Types of Triggers

If possible, you can do the same validation at the form (GUI) level and provide the user with some drop-down option.

You can also try putting these in a separate table which can be accessed by all.

Just some thoughts...

share|improve this answer
    
I am currently enforcing the validation at the GUI level, but I was interested in knowing, if there was a more elegant solution. –  Devdatta Tengshe May 30 '11 at 7:56
    
I think validating at the GUI level is the most manageable and pretty elegant solution. Till the time user is not getting an option to enter invalid data, things are fine. May I ask why would you like to implement it ta the DB level? It would require much more work though... –  ujjwalesri May 30 '11 at 9:28
    
I want to do it at the database level, since the database might be accessed by multiple applications in the future. –  Devdatta Tengshe Jun 1 '11 at 4:00
add comment

I was told that i need to use Lookup tables for this.

I have asked the following question on Stackoverflow about it: How to use LookUp tables in oracle?

share|improve this answer
add comment

I know the question is specific to Oracle -- I'm posting on the off chance someone is looking to emulate ESRI geodatabase domains using PostgreSQL/PostGIS. Simply create an enumerated data type.

According to the documentation:

Enumerated (enum) types are data types that comprise a static, ordered set of values. They are equivalent to the enum types supported in a number of programming languages. An example of an enum type might be the days of the week, or a set of status values for a piece of data.

I learned from quick internet search that enumerated types are not supported in Oracle but can be mimicked using stored procedures.

share|improve this answer
    
That seems like a very handy feature! –  Devdatta Tengshe Jun 1 '11 at 14:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.