Keywords

Keywords have a special meaning in the Oracle database, and a specific role to play in the context they appear. FUNCTION, MAX, COMMIT are some examples of Oracle keywords.

Thumbnail image for 15 Things You Should Know about the ORDER BY Clause

15 Things You Should Know about the ORDER BY Clause

What is the precedence of sorting in a multi-column ORDER BY? How does ORDER BY sort nulls? What does ORDER SIBLINGS BY do? Answers to these questions and more about Oracle’s ORDER BY clause.

Read the Full Article →
Thumbnail image for MERGE: Insert New Rows, Update Existing Rows in One Shot

MERGE: Insert New Rows, Update Existing Rows in One Shot

MERGE in Oracle combines the power of INSERT and UPDATE into one power-packed statement

Read the Full Article →
Thumbnail image for How to Manage those Pesky NULLs when Sorting Data

How to Manage those Pesky NULLs when Sorting Data

How to position NULL values in the sort column – send them to the top or the bottom in the result set with this ORDER BY NULLs FIRST or LAST.

Read the Full Article →
Thumbnail image for LTRIM and TO_CHAR…and a “Strange” Query

LTRIM and TO_CHAR…and a “Strange” Query

When we place the output of TO_CHAR(102.3, ‘000000.0’) as the input of the LTRIM function with ‘0’, we expect to get 102.3. That’s not how it works though – the zeroes on the left do not get trimmed. Can you tell why this is so? This article gives you the answer.

Read the Full Article →
Thumbnail image for The Magic Of ROWNUM

The Magic Of ROWNUM

Pseudocolumn ROWNUM in Oracle, which assigns a number to every row returned by a query, has properties so interesting it almost looks like magic!

Read the Full Article →
Thumbnail image for The Difference Between UNION and UNION ALL

The Difference Between UNION and UNION ALL

Both UNION and UNION ALL concatenate the result sets of two separate SQLs. Where they differ is in the way they handle duplicates.

Read the Full Article →
Thumbnail image for IN = EXISTS, but beware: NOT IN is not the same as NOT EXISTS!

IN = EXISTS, but beware: NOT IN is not the same as NOT EXISTS!

In Oracle SQL queries, IN and EXISTS are interchangeable. Many of us assume therefore, that NOT IN and NOT EXISTS are also interchangeable. That’s not the case though.

Read the Full Article →
Thumbnail image for Which is faster – IN or EXISTS?

Which is faster – IN or EXISTS?

A question asked multiple times over on Oracle forums: Which is faster – IN or EXISTS? The short answer, post-Oracle 9i is: Both are pretty much the same!

Read the Full Article →
Thumbnail image for Why the SQL WITH clause is not exactly like a function definition

Why the SQL WITH clause is not exactly like a function definition

SQL WITH clause appears similar in concept to a function definition in procedural code, but it differs in an important way in older Oracle versions. The error ORA-32035: unreferenced query name defined in WITH clause informs you about this difference.

Read the Full Article →
Thumbnail image for Write Smarter Queries with the SQL WITH Clause

Write Smarter Queries with the SQL WITH Clause

SQL WITH clause, or the subquery factoring clause, makes queries more efficient and readable. When a subquery is being processed multiple times, WITH lets you factor it out, give it a name and then reference the name wherever needed in the query.

Read the Full Article →