Difficulty: Easy
Correct Answer: Sequences guarantee valid surrogate key values.
Explanation:
Introduction:
Sequences are lightweight number generators frequently used to populate surrogate keys in Oracle. Understanding what sequences do and do not guarantee is essential for schema design, data integrity, and troubleshooting gaps in identifiers. This question targets a common misconception about “guarantees.”
Given Data / Assumptions:
Concept / Approach:
Sequences guarantee uniqueness at the generator level (no two calls to NEXTVAL return the same number). However, sequences do not guarantee “valid” surrogate keys in the broader sense of business correctness, continuity, or absence of gaps. If a transaction rolls back after consuming a number, that value is lost to the sequence stream; caching can also skip numbers during instance restarts. Therefore, any claim that sequences “guarantee valid surrogate key values” is not correct, because “valid” might imply additional constraints (no gaps, meaningfulness, or referential correctness) that are outside the scope of the sequence mechanism.
Step-by-Step Solution:
1) Evaluate uniqueness: sequences provide unique numbers per call.2) Evaluate validity: business validity depends on constraints and application logic, not the sequence alone.3) Consider gaps: rollbacks and cache behavior introduce gaps, which are acceptable but contradict “validity” if interpreted as “gapless.”4) Conclude that the “guarantee valid” statement is not true.
Verification / Alternative check:
Oracle documentation notes that sequences are independent objects; they do not guarantee gapless series and are not transactional. This confirms that “valid surrogate key values” is an overreach.
Why Other Options Are Wrong:
Common Pitfalls:
Expecting sequences to enforce business integrity. Use constraints (PRIMARY KEY, FOREIGN KEY) and application validations for that purpose.
Final Answer:
Sequences guarantee valid surrogate key values.
Discussion & Comments