Statement termination in SQLPlus: “The semicolon terminates a SQL statement (and executes it).” Decide whether this rule holds in Oracle client usage.

Difficulty: Easy

Correct Answer: Correct

Explanation:


Introduction / Context:
Knowing how statements are terminated and executed is essential for reliable scripting. SQLPlus uses specific terminators to submit commands to the database. This question evaluates the role of the semicolon in ending and executing SQL statements.



Given Data / Assumptions:

  • Client is SQLPlus or another Oracle client that honors semicolon as a statement terminator.
  • We are discussing SQL statements (SELECT, DML, DDL), not the entire PL/SQL execution flow.
  • For PL/SQL blocks, a slash (/) on a line by itself is typically used to execute after the block is entered.


Concept / Approach:
In SQLPlus, a semicolon ends the SQL statement and causes it to be sent to the database engine for execution. For PL/SQL blocks, semicolons terminate individual statements within the block, but the block itself is executed when you enter a slash on a new line. For plain SQL, however, the semicolon both terminates and triggers execution. Thus, saying that “the semicolon terminates a SQL statement (and executes it)” is correct for SQL statements in SQLPlus.



Step-by-Step Solution:

Type a SQL statement without a terminator; it remains in the buffer.Add a semicolon and press Enter; SQLPlus submits the statement.Observe results returned or DDL/DML feedback.For PL/SQL, finish the block, then use / to execute.


Verification / Alternative check:
Try a quick SELECT 1 FROM dual; in SQL*Plus and confirm the semicolon triggers execution. Then type a PL/SQL block and note that execution requires slash on a new line.



Why Other Options Are Wrong:

  • Limiting to SELECT is incorrect—DDL and DML behave the same.
  • AUTOCOMMIT affects transaction commits, not statement termination.
  • Inside PL/SQL, semicolons end statements but do not execute the block; slash does.


Common Pitfalls:
Forgetting the slash for PL/SQL; assuming Enter alone executes.



Final Answer:
Correct

Discussion & Comments

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