Chapter 3: Using Simple Functions


Overview

In this chapter, you ll learn about some of the Oracle database s built-in functions. A function accepts zero or more input parameters and returns an output parameter. There are two main types of functions you can use in an Oracle database:

  • Single row functions    These operate on one row at a time and return one row of output for each input row. An example single row function is CONCAT( x , y ) , which appends y to x and returns the resulting string.

  • Aggregate functions    These operate on multiple rows at the same time and return one row of output. An example aggregate function is AVG( x ) , which returns the average of x where x may be a column or, more generally , an expression.

You ll learn about single row functions first, followed by aggregate functions. There are also other more complex types of functions that you ll learn about as you progress through this book.

Sometimes you might want to group blocks of rows in a table and get some information on those groups of rows. For example, you might want to get the average price for the different types of products in the products table. In the final section of this chapter, you ll learn how to group blocks of similar rows together, and also see how to use those blocks of rows in aggregate functions.




Oracle Database 10g SQL
Oracle Database 10g SQL (Osborne ORACLE Press Series)
ISBN: 0072229810
EAN: 2147483647
Year: 2004
Pages: 217

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net