Oracle Deep Dive Flashcards
Oracle-specific data types Pseudocolumns: ROWNUM, ROWID Sequences and triggers for auto-incrementing MERGE statement for upserts PL/SQL packages, cursors, and exception handling Oracle optimizer hints Oracle tools: SQL*Plus, SQL Developer (29 cards)
What are Oracle-specific data types?
Oracle includes data types like NUMBER, VARCHAR2, DATE, CLOB, BLOB, and RAW, tailored for its storage and performance needs.
What is the ROWNUM pseudocolumn in Oracle?
ROWNUM assigns a unique number to each row returned by a query, starting from 1, used for limiting rows.
What is the ROWID pseudocolumn in Oracle?
ROWID represents the unique physical address of a row in a table and can be used for fast access.
What are sequences in Oracle?
Sequences are database objects that generate unique numeric values, often used to simulate auto-incrementing fields.
What are triggers in Oracle used for?
Triggers are procedures that automatically execute in response to specific events on a table or view.
What is the MERGE statement in Oracle?
MERGE allows conditional INSERT or UPDATE operations in one statement, also known as ‘upsert’.
What is PL/SQL in Oracle?
PL/SQL is Oracle’s procedural language extension to SQL, allowing control structures, loops, and exception handling.
What are PL/SQL packages?
Packages group procedures, functions, variables, and types into a single unit for modular programming and reuse.
What are PL/SQL cursors?
Cursors let you fetch and process query result rows one at a time within PL/SQL blocks.
What is exception handling in PL/SQL?
It allows handling runtime errors using EXCEPTION blocks to improve program robustness.
What are optimizer hints in Oracle?
Optimizer hints override the default execution plan chosen by the Oracle optimizer.
What is SQL*Plus?
SQL*Plus is a command-line interface for running SQL and PL/SQL commands in Oracle.
What is Oracle SQL Developer?
A graphical tool for querying, managing, and debugging Oracle databases.
What is an advantage of Oracle pseudocolumns?
They provide internal metadata access useful for pagination and debugging.
What is a disadvantage of relying on ROWNUM?
ROWNUM can behave unpredictably with ORDER BY unless used in subqueries.
What’s a best practice when using sequences?
Use them with triggers or default clauses to ensure unique keys and avoid concurrency issues.
What’s a common use case for the MERGE statement?
Synchronizing data between staging and target tables without multiple statements.
What’s a use case for PL/SQL packages?
Encapsulating related procedures like billing or user management into logical units.
What is the architectural impact of using packages?
Promotes modularization, version control, and encapsulation in large Oracle applications.
What is a performance benefit of optimizer hints?
Helps fine-tune execution plans for critical queries when the optimizer underperforms.
What’s a fault tolerance issue with triggers?
Poorly written triggers can cause unintended side effects or recursive execution.
What’s a common monitoring approach for Oracle performance?
Using tools like AWR, ADDM, and SQL Trace to analyze query and system performance.
What is a real-world tradeoff when using MERGE?
While convenient, MERGE can be slower than separate INSERT/UPDATE for simple cases and harder to debug.
What’s a gotcha with ROWID usage?
ROWID changes if the row is moved (e.g., via export/import), so it shouldn’t be used as a permanent identifier.