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)

1
Q

What are Oracle-specific data types?

A

Oracle includes data types like NUMBER, VARCHAR2, DATE, CLOB, BLOB, and RAW, tailored for its storage and performance needs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the ROWNUM pseudocolumn in Oracle?

A

ROWNUM assigns a unique number to each row returned by a query, starting from 1, used for limiting rows.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the ROWID pseudocolumn in Oracle?

A

ROWID represents the unique physical address of a row in a table and can be used for fast access.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are sequences in Oracle?

A

Sequences are database objects that generate unique numeric values, often used to simulate auto-incrementing fields.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are triggers in Oracle used for?

A

Triggers are procedures that automatically execute in response to specific events on a table or view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the MERGE statement in Oracle?

A

MERGE allows conditional INSERT or UPDATE operations in one statement, also known as ‘upsert’.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is PL/SQL in Oracle?

A

PL/SQL is Oracle’s procedural language extension to SQL, allowing control structures, loops, and exception handling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are PL/SQL packages?

A

Packages group procedures, functions, variables, and types into a single unit for modular programming and reuse.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are PL/SQL cursors?

A

Cursors let you fetch and process query result rows one at a time within PL/SQL blocks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is exception handling in PL/SQL?

A

It allows handling runtime errors using EXCEPTION blocks to improve program robustness.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are optimizer hints in Oracle?

A

Optimizer hints override the default execution plan chosen by the Oracle optimizer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is SQL*Plus?

A

SQL*Plus is a command-line interface for running SQL and PL/SQL commands in Oracle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is Oracle SQL Developer?

A

A graphical tool for querying, managing, and debugging Oracle databases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is an advantage of Oracle pseudocolumns?

A

They provide internal metadata access useful for pagination and debugging.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a disadvantage of relying on ROWNUM?

A

ROWNUM can behave unpredictably with ORDER BY unless used in subqueries.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What’s a best practice when using sequences?

A

Use them with triggers or default clauses to ensure unique keys and avoid concurrency issues.

17
Q

What’s a common use case for the MERGE statement?

A

Synchronizing data between staging and target tables without multiple statements.

18
Q

What’s a use case for PL/SQL packages?

A

Encapsulating related procedures like billing or user management into logical units.

19
Q

What is the architectural impact of using packages?

A

Promotes modularization, version control, and encapsulation in large Oracle applications.

20
Q

What is a performance benefit of optimizer hints?

A

Helps fine-tune execution plans for critical queries when the optimizer underperforms.

21
Q

What’s a fault tolerance issue with triggers?

A

Poorly written triggers can cause unintended side effects or recursive execution.

22
Q

What’s a common monitoring approach for Oracle performance?

A

Using tools like AWR, ADDM, and SQL Trace to analyze query and system performance.

23
Q

What is a real-world tradeoff when using MERGE?

A

While convenient, MERGE can be slower than separate INSERT/UPDATE for simple cases and harder to debug.

24
Q

What’s a gotcha with ROWID usage?

A

ROWID changes if the row is moved (e.g., via export/import), so it shouldn’t be used as a permanent identifier.

25
What’s a potential issue with optimizer hints?
Hints can become outdated and mislead the optimizer as data or schema changes.
26
What’s a best practice for exception handling in PL/SQL?
Catch only expected exceptions and re-raise unknown ones to avoid hiding bugs.
27
What’s a common interview question on Oracle sequences?
How do you use sequences to implement auto-increment behavior in Oracle?
28
What’s an advantage of SQL Developer over SQL*Plus?
SQL Developer provides a user-friendly GUI, integrated debugging, and better development experience.
29
What’s a use case for cursors in PL/SQL?
Processing row-by-row logic like generating customized reports or aggregating data.