Are Oracle identifiers and commands case sensitive by default?

Difficulty: Easy

Correct Answer: Invalid (unquoted identifiers and commands are case-insensitive by default)

Explanation:


Introduction / Context:
Understanding case sensitivity rules helps avoid naming surprises. In Oracle, unquoted identifiers are folded to uppercase internally, and SQL keywords are case-insensitive. Case matters for string literals and for identifiers that are created with double quotes, which preserve case exactly.


Given Data / Assumptions:

  • Typical DDL uses unquoted identifiers (CREATE TABLE emp…).
  • Quoted identifiers ("EmpName") are sometimes used but discouraged.
  • SQL keywords (SELECT, FROM) are not case sensitive.


Concept / Approach:
If you create a table as CREATE TABLE emp (ename VARCHAR2(10)), the data dictionary stores EMP and ENAME. You can reference them as emp, EMP, or EmP. If you instead create "Emp" with double quotes, you must always reference it exactly as "Emp". Thus, the statement that “all Oracle names and commands are case sensitive” is incorrect in the default, recommended style.


Step-by-Step Solution:

Create an unquoted object, then query it using different letter cases — all work.Create a quoted object "Emp"; attempts to use EMP without quotes fail.Recognize that string literal comparisons are case-sensitive unless functions or collations change behavior.SQL*Plus command names are also case-insensitive.


Verification / Alternative check:
DESCRIBE Emp and DESCRIBE EMP succeed for an unquoted object; only DESCRIBE "Emp" works for a quoted one.


Why Other Options Are Wrong:

  • NLS_SORT affects string comparison, not identifier case folding.
  • Tablespace defaults are irrelevant; the rule applies equally to tables and columns.


Common Pitfalls:
Using quoted identifiers and later forgetting exact case; mixing cases in client code; assuming case-insensitive string comparisons.


Final Answer:
Invalid (unquoted identifiers and commands are case-insensitive by default)

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion