Home » SQL & PL/SQL » SQL & PL/SQL » How to extend data in select table
icon4.gif  How to extend data in select table [message #406214] Tue, 02 June 2009 21:10 Go to next message
carillpower
Messages: 48
Registered: April 2009
Location: malaysia
Member

Hi all guru's!!

I have doubt here...
actually in when i select from 1 of my table it will come out like this

num num_range
---- ----------
9 under 10
10 10-14
15 15-19
20 20-24


is there any possibilities that i can change the result to like this?? Confused ::

num num_range
---- ----------
9 under 10
10 10-14
11 10-14
12 10-14
13 10-14
14 10-14
15 15-19
16 15-19
17 15-19
18 15-19
19 15-19
20 20-24

Please anyone help me on this....








Re: How to extend data in select table [message #406224 is a reply to message #406214] Tue, 02 June 2009 22:46 Go to previous message
joicejohn
Messages: 327
Registered: March 2008
Location: India
Senior Member
Use Oracle Row Generator Technique

SQL> SELECT     LEVEL
  2        FROM DUAL
  3       WHERE LEVEL BETWEEN 9 AND 20
  4  CONNECT BY LEVEL <= 20
  5  /

     LEVEL
----------
         9
        10
        11
        12
        13
        14
        15
        16
        17
        18
        19

     LEVEL
----------
        20

12 rows selected.

Join this output with your table output.

You can read up on them in the following link:
Oracle Row Generator Technique
You might have to use Lead Function also. Refer Analytic functions by Example

Hope this helps.
Regards,
Jo

[Updated on: Tue, 02 June 2009 23:24]

Report message to a moderator

Previous Topic: Oracle: SQL to query all column names on all tables
Next Topic: Oracle SQL Query
Goto Forum:
  


Current Time: Fri Dec 02 14:04:12 CST 2016

Total time taken to generate the page: 0.22481 seconds