The time has come for Country / State-Province lookup tables for Oracle! Building on my earlier post on Country / State Lookup Tables for SQL Server I’ve built a new script for Oracle. This script will create two tables, two sequences for the primary keys, and two triggers to setup the auto-numbering. Run the script and you should be good to go!
**Update 2011.12.09 – I’ve posted an Oracle specific version of the Country/State/Province lookup SQL.
Every time I build a contact form/database I hit this problem. I need a set of tables for Country, State/Province lookup. “But, that’s like 60 records and I don’t wanna type out every state and province!”.
Every time, I hit the Google looking for SQL scripts – and I can’t seem to find anything, or I find that one script for mySQL. The last time I did this, I created a set of SQL scripts and I saved them. I forgot that I saved them – and made another SQL script. Doh.
This time when I was working on the new contact form for this site, I decided to write this blog post in hopes that the next time I need to do this – when I search Google my blog might come up and remind me not to re-invent the wheel. So I’ve included a zip with the SQL script here. This script is for SQL server 2005 – but will translate over to Oracle very easily.
If you find any problems with the script, or feel like adding more countries, feel free to pass those changes along to me!