Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Getting succeeding and preceeding records
I dont know exactly what you want, so I try to give
two possible solutions:
create or replace view recsta_view
as
select rownum lineno, invno from fms0001.recsta;
now you (or your application) can select:
select * from recsta_view where lineno beteen 1 and 10; select * from recsta_view where lineno beteen 11 and 20; ...
2. select with (fixed) search-criteria:
create or replace view recsta_view
as
select rownum lineno, invno from fms0001.recsta where invno like '12345%';
now you (or your application) can select: (here you get only invnos' with '12345%'...)
select * from recsta_view where lineno beteen 1 and 10; select * from recsta_view where lineno beteen 11 and 20; ...
hth
Rüdiger J. Schulz
rjs_at_berlin.de
j_gippert_at_yahoo.com (jgippert) wrote:
>Hello everybody!
>
>I´ve got a problem doing an SQL request to our Oracle 8i server. I´d
>like to do a SELECT statement, which gives me the result and the next
>10 succeeding records. So I used the following stament:
>
>select invno from fms0001.recsta where invno like '12345%' and
>rownum<=10
>
>This gives me the first 10 (in this particular case) invoices-no.
>which start with '12345'. Now, our customer also wants to see the 10
>invoice numbers that come *before* the searched number. I already
>tried something like ".. rownum -10" but that doesn´t seem to work. Is
>there a SQL-statement that does this job or do I have to make a
>pre-select on all records and then programm our software to do the
>rest of the work?
>
>Any help on this would be very appreciated!!
>
>Thanks in advance!
>
>Bye,
>Joerg!
-- __________________________________________________________ News suchen, lesen, schreiben mit http://newsgroups.web.deReceived on Wed Nov 14 2001 - 03:39:42 CST