Wednesday, February 22, 2006

Never noticed this before

So I was searching through the latest Oracle 10g SQL Reference,
check out what I found on page 5-175:

SELECT manager_id, last_name, salary, SUM(salary)
OVER (PARTITION BY manager_id ORDER BY salary RANGE UNBOUNDED PRECEDING) l_csum
FROM employees;

MANAGER_ID LAST_NAME SALARY L_CSUM
---------- --------- ------ ------
100 Mourgos 5800 5800
100 Vollman 6500 12300
...

I'm in the Oracle default HR schema! I'm employee 123 and I report directly to KING, the President! Of course, I'm one of the lowest paid managers, but still.

Of course, the first name is Shonta. But I can dream, right? I can pretend that I'm one of Lex de Haan's fictional colleagues, right?

I also saw this in the latest version of Oracle 9i documentation:
SQL Reference:
Page 365, 6-155 for the example of SUM.
Page 1532, 18-42 on using LEVEL Pseudo-Column.

and Sample Schemas:
Page 68, section 4-28 on Oracle's sample HR Schema

So it must have been around for awhile. I think that's so cool! I'm going to write Oracle and ask them to fix my first name. I urge you to do the same in your implementations:

UPDATE employees SET first_name = 'Robert' where last_name = 'Vollman';

Comments:
Oracle: Sure we can..but are you sure you dont want salary column updated ?
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?