Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Nice present, only discovered for Christmas

Nice present, only discovered for Christmas

From: Mladen Gogala <gogala_at_sbcglobal.net>
Date: Sun, 25 Dec 2005 08:48:25 GMT
Message-Id: <pan.2005.12.25.08.48.24.275868@sbcglobal.net>


On my Oracle 10.2, I got the following:

  1 declare
  2 cursor csr is select ename,deptno,
  3 rank() over (partition by deptno order by sal)   4 as sal_seq
  5 from emp
  6 order by deptno;
  7 begin
  8 for c in csr
  9 loop
 10 dbms_output.put_line(c.ename||' '||c.deptno||' '||c.sal_seq);  11 end loop;
 12* end;
SQL> /
MILLER 10 1
CLARK 10 2
KING 10 3
SMITH 20 1
ADAMS 20 2
JONES 20 3
SCOTT 20 4
FORD 20 4
JAMES 30 1
MARTIN 30 2
WARD 30 2
TURNER 30 4
ALLEN 30 5
BLAKE 30 6 PL/SQL procedure successfully completed.

SQL> I was fully expecting a syntax error, which would happen in version 8i and 9i. In 10.2, one can use PL/SQL and analytic functions, without the need to resort to dynamic SQL and things like open csr for '<sql that contains an analytic function>'; Nice! This is really a merry Christmas.

-- 
http://www.mgogala.com
Received on Sun Dec 25 2005 - 02:48:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US