Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 14th, 2008, 08:29 AM
Member
 
Join Date: Jan 2008
Posts: 70
Default How to increment more than one or to some othe rnumber with Oracle for loop

Hello
I have some problem in for loop. actually i want to write some procedures based on oracle and i have to increment 5 for each loop. i want to know is it possible to change the default increment 1 to any other.
If yes then please give me suggestion that how can i do so
Thanks
Reply
  #2  
Old August 14th, 2008, 09:01 AM
debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 6,867
Default

just try something like this

Expand|Select|Wrap|Line Numbers
  1. BEGIN
  2. FOR I IN  1..100 LOOP
  3. --if the number is divisible by 2 then process further..
  4. IF MOD(I,2)=0 THEN 
  5. dbms_output.put_line(I);
  6. END IF;
  7. END LOOP;
  8. END;
  9.  
Reply
  #3  
Old August 14th, 2008, 09:46 AM
Newbie
 
Join Date: Aug 2008
Posts: 20
Default

I think better use WHILE..DO..LOOP with your need. In this manner you can manipulate how much increament do you want to have.
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles