NO_DATA_FOUND when using aggregate functions like count, min, max, avg…

A common misconception when writing PL/SQL select …. into … statements is that if it is an aggregation query (a query that is using an aggregation like count, max, min, avg, etc.) then they always return a result – possibly null – so a NO_DATA_FOUND exception will never occur.

During a post on the Oracle Community Forums, a regular and respected contributor made a statement to this effect, before the classic error was pointed out to him.

Let’s take a look at when, how and why NO_DATA_FOUND exceptions occur and show that they can indeed occur when using aggregated functions.
Read more…

Advertisements

Oracle External Tables – Part 1

If Only I Could Write A SQL Query On Data in a File…

Imagine you have a text file with data in, such as a CSV (character separated values) or ASCII fixed width fields, wouldn’t it be great if you could treat it like a table and write SQL queries against in? ¬†Well you can and that’s exactly what Oracle’s External Tables functionality allow you to do!
Read more…