Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Previous record and next record in pl/sql
You can use the following table operation to navigate in the table:
DECLARE
TYPE TAB_TYP IS TABLE OF NUMBER INDEX BY BINARY INTEGER;
Tab TAB_TYP; Idx BINARY_INTEGER;
Tab.DELETE; -- Deletes the whole table Tab.DELETE(Idx); -- Deletes element with index Idx Tab.DELETE(Idx1, Idx2); -- Deletes the elements between Idx1 and Idx2Ex := Tab.EXISTS(Idx); -- Test for existance of element with index Idx Count := Tab.COUNT; -- The number of elements in tab
TabContents := Tab(Tab.PRIOR(Idx)); -- previous c
TabContents := Tab(Tab.NEXT(Idx)); -- next c
END;
Hope this will help
Andreas Prusch
In article <6o2cno$nla$1_at_thorn.cc.usm.edu>,
rsurabhi_at_orca.st.usm.edu (Rajeshwar Rao Surabhi) wrote:
> Hi all,
> I need an help to get an idea of how to do the following task. I
> used pl/sql tables but of no help. There ia a table 'a' with columns
> a,b,c,d,e. Suppose if i encounter the value for d='e', i want to select
> the previous record's column 'c', present rcords column 'c' and the next
> record's column c. I have iterate this to entire table.
>
> The output is to look like this:-
>
> a, b previous 'c' present 'c' next 'c'
> - - ---------- ---------- --------
>
> Any help is greatly appreciated.
>
> Thanks in advance
> --
> ******************************************************************************
> RAJESHWAR PH: 601-296-0937
> 201, N 34TH AVE, APT # 3 E-MAIL: rsurabhi_at_orca.st.usm.edu
> HATTIESBURG, MISSISSIPPI
> MS-39401
> (OR)
> USM BOX 5850, USM
> HATTIESBURG,
> MS 39406
>
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Fri Jul 10 1998 - 01:57:55 CDT
![]() |
![]() |