Difficulty: Easy
Correct Answer: CHAR
Explanation:
Introduction / Context:Choosing between CHAR and VARCHAR2 in Oracle depends on whether the text length is fixed or variable. Fixed-length codes (e.g., country_code, status_code) benefit from CHAR for simpler semantics and potential storage/CPU advantages at small sizes.
Given Data / Assumptions:
Concept / Approach:
Use CHAR(n) for fixed-length fields; Oracle pads to length n for storage/comparison semantics. VARCHAR2(n) is best for variable-length fields. LONG is obsolete and discouraged; CLOB is for large character data; NUMBER is numeric storage only.
Step-by-Step Solution:
1) Determine if length is fixed or variable.2) For fixed-length, select CHAR(n).3) For variable-length, prefer VARCHAR2(n).4) Avoid deprecated/unsuitable types (LONG, NUMBER for text).Verification / Alternative check:
Oracle documentation advises VARCHAR2 for variable-length character strings and CHAR for fixed-length semantics, with LONG retained only for backward compatibility.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
CHAR.
Discussion & Comments