banjora {na+au+uk{auxilium}}

 

 

Our deepest apologies as this site is currently under construction... also,  this site is being developed with the new Opera 9.20 browser with speed dial... check it out!

 

 Opera 9 - Always secure with Opera




first_value {analytical function}

Posted: November 19, 2008 at 2:35 pm by Liam A. Purefoy
No Comments
Filed Under: Development, Oracle RDBMS, plsql

first_value {analytical function}The Oracle SQL analytical function FIRST_VALUE returns the first value in an ordered set of values. If the first value in the set is null, then the function returns NULL unless you specify IGNORE NULLS. This setting is useful for data densification. If you specify IGNORE NULLS, then FIRST_VALUE returns the fist non-null value in the set, or NULL if all values are null.

You cannot use FIRST_VALUE or any other analytic function for expr. That is, you cannot nest analytic functions, but you can use other built-in function expressions for expr.

APPLIES TO: Oracle 9i, Oracle 10g, Oracle 11g

SYNTAX: FIRST_VALUE(expr [IGNORE NULLS]) OVER (analytic clause)

EXAMPLE: The following example selects, for each employee in Department 20 and 30, the name of the employee with the lowest salary.

SELECT
 emp.department_id,
 emp.last_name,
 emp.salary,
 FIRST_VALUE(emp.last_name) OVER (PARTITION BY emp.department_id ORDER BY
salary ASC ) AS lowest_salary
FROM
 employees emp
WHERE
 emp.department_id in (20, 30);

department_id last_name salary lowest_salary
20 Fay 6000 Fay
20 Hartstein 13000 Fay
30 Colmenares 2500 Colmenares
30 Himuro 2600 Colmenares
30 Tobias 2800 Colmenares
30 Baida 2900 Colmenares
30 Khoo 3100 Colmenares
30 Raphaely 11000 Colmenares

 

OVERVIEW: Analytic functions compute an aggregate value based on a group of rows. They differ from aggregate functions in that they return multiple rows for each group. The group of rows is called a ‘window’ and is defined by the analytic_clause. For each row, a sliding window of rows is defined. The window determines the range of rows used to perform the calculations for the current row. Window sizes can be based on either a physical number of rows or a logical interval such as time.

Analytic functions are the last set of operations performed in a query except for the final ORDER BY clause. All joins and all WHERE, GROUP BY, and HAVING clauses are completed before the analytic functions are processed. Therefore, analytic functions can appear only in the select list or ORDER BY clause.

  • Navigation
    • Home
    • About Us
    • Contact Us
    • Portfolio
    • Site Map
  • Categories
    • Development
    • Hardware
    • Informational
    • Linux
    • Oracle RDBMS
    • Oracle VM
    • plsql
    • Reviews
    • Software
    • VMware
    • Wordpress
    • Xen
  • Archives
    • August 2009
    • May 2009
    • February 2009
    • November 2008
    • February 2008
    • December 2007
    • November 2007
  • Recent Posts
    • Oracle VM 2.1.5 Server, Final Analysis
    • Installing Oracle VM 2.1.2 Server, Part I
    • The Differences Between Oracle 10g Releases
    • last & first {aggregate function}
    • cume_dist {aggregate, analytic function}
    • dense_rank {aggregate, analytic function}
    • first_value {analytical function}
    • Blocking Executables from an Oracle DB
    • Entrepreneurs benefit with Linkedin…
    • Treo 750 upgrade to Windows Mobile 6!

About Us

Welcome to Banjora [auxilium] entrepreneurs!

Promoting entrepreneurship by supplementing startup companies with viable technology solutions…

Please be patient… this website is currently being revised and energized….

info@banjora.com

Recent Postings

  • Oracle VM 2.1.5 Server, Final Analysis
  • Installing Oracle VM 2.1.2 Server, Part I
  • The Differences Between Oracle 10g Releases
  • last & first {aggregate function}
  • cume_dist {aggregate, analytic function}
  • dense_rank {aggregate, analytic function}
  • first_value {analytical function}
  • Blocking Executables from an Oracle DB
  • Entrepreneurs benefit with Linkedin…
  • Treo 750 upgrade to Windows Mobile 6!

Monthly Archives

  • August 2009
  • May 2009
  • February 2009
  • November 2008
  • February 2008
  • December 2007
  • November 2007

 

Category Cloud

    Development (8)
    Hardware (3)
    Informational (4)
    Linux (2)
    Oracle RDBMS (6)
    Oracle VM (2)
    plsql (6)
    Reviews (2)
    Software (4)
    VMware (2)
    Wordpress (1)
    Xen (2)

    WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

Site Search

Site Navigation

  • Home
  • About Us
  • Contact Us
  • Portfolio
  • Site Map

banjora {na+au+uk{auxilium}} version 2.7.1 — 23 queries, 0.406 seconds

Entries RSS Comments RSS