Grouping RowID's [message #21282] |
Wed, 24 July 2002 05:57 |
Leo
Messages: 14 Registered: March 2000
|
Junior Member |
|
|
Hello everyone,
I'm am using Mercator middleware to extract records from a stage table that may potentially have many records. I would like to to use ranges of rowid's to limit the extracts. Is there a SQL that give me that the following result?
Say if there are 100 records in a table the rowid and I put in a parameter of range of 10.
Min(rowid), Max(rowid)
1, 10
11, 20
21, 30
etc...
Thanks in advance...
Leo
|
|
|
Re: Grouping RowID's [message #21283 is a reply to message #21282] |
Wed, 24 July 2002 06:53 |
|
Mahesh Rajendran
Messages: 10707 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
do you want to use rowid?????
i beleive you are just mentioning some numbering.
rowid is internally allocated unique id for each record in database.
anyhow if you want to have a range over u can use something like
SQL> select decode (greatest( nvl(sal,0) , 1000) , 1000 , '0-1000'
2 , decode(greatest( nvl(sal,0) , 1500), 1500, '1001-1500'
3 , '1500-') ) Sal_Range
4 , sum(sal)
5 , count(empno)
6 from emp
7 group by
8 decode (greatest( nvl(sal,0) , 1000) , 1000 , '0-1000'
9 , decode(greatest( nvl(sal,0) , 1500), 1500, '1001-1500'
10 , '1500-') );
SAL_RANGE SUM(SAL) COUNT(EMPNO)
--------- ---------- ------------
0-1000 1750 2
1001-1500 6400 5
1500- 20875 7
if you dont want to display the range, th
|
|
|