Category: Oracle

Unique Numbers in Oracle and MySQL

It’s common in database work to need unique integers. They get used in id columns in tables, and for other purposes. This note compares and contrasts the Oracle and MySQL approaches to doing this. MySQL handles this need with autoincrement columns, in tables and Oracle handles it with database objects called sequences. In MySQL, when you have an autoincrement column… Read more →

Using SQL to report by time intervals in Oracle

This is an Oracle-specific edition of the article explaining the same subject for MySQL. It’s often helpful to use SQL to group and summarize information by periods of time. For example, we might like to examine sales data. For example, we might have a table of individual sales transactions like so. Sales: sales_id int sales_time date net decimal(7,2) tax decimal(7,2) gross decimal(7,2)… Read more →

Fast nearest-location finder for Oracle

Elsewhere I have written an article on fast location finding for the MySQL and PostgreSQL databases. This article shows an adaptation of that work for the Oracle database. If you need data to work with, here’s a US Zip Code table in SQL suitable for an Oracle database. Please don’t use this data in production. The Great Circle Distance Formula What’s… Read more →