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: PL/SQL Logic Help Needed...

Re: PL/SQL Logic Help Needed...

From: Charanjiv <ckalha_at_gmail.com>
Date: 21 Sep 2004 02:32:48 -0700
Message-ID: <4277f1bd.0409210132.4b4c9dea@posting.google.com>


If i remember rightly ..this is what we used to do in 8.0

select a.*, rownum rnum from
  ( select * from emp order by sal ) a
where rownum <= 5 ;

depending on ur actual query (replacing "select * from emp order by sal" in the example) this cud a quite resorce intensive. Also you can put the update/select in an procedure and return the ref cursor (dont remember if you could return ref cirsor in 8.0)

Hope this helps ..

Charanjiv  

timasmith_at_hotmail.com (Tim Smith) wrote in message news:<a7234bb1.0409191846.2938318a_at_posting.google.com>...
> Hi,
>
> I have a table as follows
> pk_id status
> 1 P
> 2 P
> 3... U
> 30 U
>
> I want to return a reference cursor for the next 5 (by order of pk_id)
> records and (within this PL/SQL) set the status to Q so that if the
> procedure is executed again it never returns the same record.
>
> I believe I need to
> a) select for update a list of U's e.g. 3,4,5,6, and 7
> b) set status to Q
> c) return a ref cursor for the original 5 records
>
> Is this possible without using a (physical) temporary table in version
> 8.0.5 (yes, upgrade pending..). A data structure would be fine if
> possible.
Received on Tue Sep 21 2004 - 04:32:48 CDT

Original text of this message

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