sequences

Replace Duplicate Ids with Unique Values

Replace Duplicates in ID Column with Unique Values

A common scenario: in the development environment, a table’s ID column is missing its unique key constraint, and developers have been creating their own data for testing. Suddenly someone realizes that the ID column has duplicates. The DBA is summoned. "Enable the unique key", the DBA is told, "but do not delete our data." Can […]

Read the Full Article →
Thumbnail image for MERGE: Insert New Rows, Update Existing Rows in One Shot

MERGE: Insert New Rows, Update Existing Rows in One Shot

MERGE in Oracle combines the power of INSERT and UPDATE into one power-packed statement

Read the Full Article →
Reset a Sequence in Oracle

How to Reset a Sequence in Oracle

Oracle does not a have ready-made command to restart a sequence. There is no direct way to do this: But I have a simple workaround to share with you. This article gives you a script to restart a sequence, explains how it works and shows you a test run with a sample sequence.

Read the Full Article →
Thumbnail image for What’s the value of auto-increment column in this insert?

What’s the value of auto-increment column in this insert?

In the last post, we saw a neat way to implement auto-increment functionality in an Oracle table. The auto-incremented column gets its value populated in the background, without the issuer of the insert statement even getting to know about it. BUT – what if the issuer of the insert statement does want to know about […]

Read the Full Article →
auto-increment-columns-faq

Auto-Increment Columns: FAQ

What is an auto-increment column? A table column of which the value increments automatically each time a row is inserted into the table. What is the use of auto-increment columns? This column usually serves as the primary key or unique identifier for each row of the table. Since the value automatically increments with each insert, […]

Read the Full Article →