How To Select Multiple Rows From Dual


Ex:1

select rownum
from dual
connect by level <=7

Output:

1
2
3
4
5
6
7


Ex:2

select * from
(select * from dual connect by level <= 1000);

Ex:3


SELECT decode(rownum,1, '1,00,000-2,00,000'
      ,2,'2,00,000-3,00,000'
      ,3,'3,00,000-4,00,000'
      ,4,'4,00,000-5,00,000'
      ,5,'5,00,000-6,00,000'
      ,6,'6,00,000-7,00,000'
      ,'Above 7 Lakh') Sal_range
From DUAL
connect by level <= 7 ;

Output:

SAL_RANGE

1,00,000-2,00,000
2,00,000-3,00,000
3,00,000-4,00,000
4,00,000-5,00,000
5,00,000-6,00,000
6,00,000-7,00,000
Above 7 Lakh


Ex:4


SELECT rownum FROM (
  SELECT 1 FROM DUAL GROUP BY CUBE(1,2,3));

output:

1
2
3
4
5
6
7
8






Comments

Popular posts from this blog

Oracle APPS Useful Queries

How to Apply Timers In Forms

Unix Shell Script For Oracle Apps