December 2010
Intermediate to advanced
451 pages
11h 16m
English
You want to invoke a function from an SQL query. For example, you want to take the quarter-hour rounding function from Recipe 4-1 and invoke it on hourly values in a database table.
Write a query and invoke the function on values returned by the SELECT statement. In the following lines, the function that was written in the previous recipe will be called. The results of calling the function from within a query are as follows:
SQL> select calc_quarter_hour(.17) from dual;
CALC_QUARTER_HOUR(.17)
----------------------
.25
SQL> select calc_quarter_hour(1.3) from dual;
CALC_QUARTER_HOUR(1.3)
----------------------
1.25
There are a few ways in which a function can be ...
Read now
Unlock full access