• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

SQL Query to print 1-n numbers?

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for(int i =0; i<n i++)
We can print 1-n numbers on the console by using above loop.

In the sameway How I can display 1-n numbers on SQL console by using SQL Query..?
Can any body help me regarding this?>
 
author & internet detective
Posts: 42173
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Krishnareddy,
Just the numbers? I don't know - SQL isn't intended for that.

If you trying to have a column with row numbers for a query, that's a different story. Oracle provides the rownum keyword for that.
 
Krish Yeruva
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,
Even Iam thinking the same.

I have googling some sites and I found something like this:

a)SELECT * FROM (SELECT LEVEL FROM dual CONNECT BY LEVEL < 10);

I haven't verified whether it is right or wrong(Because currently I didn't have the setup for that)?
Can you please let me know if you find something?
 
Power corrupts. Absolute power xxxxxxxxxxxxxxxx is kinda neat.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic