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

Home -> Community -> Usenet -> c.d.o.misc -> Re: beginner: cursors

Re: beginner: cursors

From: dombrooks <dombrooks_at_hotmail.com>
Date: 10 Apr 2007 01:52:19 -0700
Message-ID: <1176195138.974054.232010@p77g2000hsh.googlegroups.com>


Other things you might want to consider are: 1. Using a FOR LOOP
2. If you're just want the first match (where there are equal ranks) then using SELECT ... INTO and no LOOP.
3. Rather than bombing out of the loop when NOTFOUND or rk=2, restrict the rk=2 condition in the actual select: e.g. SELECT rnk,ename,sal FROM (SELECT RANK()OVER(ORDER BY ABS(E.sal - 8000)) AS RNK, E.ename, E.sal FROM empbb02 E ORDER BY rnk) WHERE rnk = 1;
4. Creating a function that accepts the salary as an input and returns the refcursor, rather than outputting to dbms_output Received on Tue Apr 10 2007 - 03:52:19 CDT

Original text of this message

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