exceptions

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

The SQL WITH clause is similar in concept to a function definition in procedural code. In a function, we factor the common code, put it all together at one place and call it as many times as needed in the main program. That’s precisely how we use the WITH clause in SQL – factor out […]

Read the Full Article →
Thumbnail image for CASE_NOT_FOUND Exception

CASE_NOT_FOUND Exception

CASE is a smarter rewrite for IF-THEN-ELSE, we said. It is for sure, but there is a difference in the way the ELSE part of it is handled. Compare the code units below, one using CASE WHEN the other using IF-ELSIF. Both are identical in logic – two defined conditions, no ELSE path.

Read the Full Article →
Thumbnail image for WHEN OTHERS THEN NULL

WHEN OTHERS THEN NULL

A few quick questions for you. Write your answers in the comments. Solutions will be published on 2nd April 2010. [Update: Answers published!] [In an Oracle interview, your answers to these questions can be deal-breakers. Think carefully!] Look at this small piece of code which inserts a row into the EMP table. You see an […]

Read the Full Article →