
270 9.5 Analysis in Practice
Cursor Expressions
A cursor expression simply allows the embedding of a cursor or pre-exe-
cuted query within a calling query, as in the following example script:
SELECT R.REGION
, CURSOR(
SELECT COUNTRY FROM COUNTRY
WHERE REGION_ID=R.REGION_ID
)
FROM REGION R;
A query, such as the script above, effectively joins the REGION and
COUNTRY tables properly, but returns each region containing all coun-
tries included within each region, sorted by country within region as shown
in Figure 9.13.
9.5 Analysis in Practice
This section will examine some examples using analysis functions and spe-
cialized analytical syntax.
Figure 9.13
An example ...