• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Change Increment index of for loop in stored procedure

 
Gireesh Mulage
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All ,

To my stored procedure of Oracle i am passing a type , which contains some array of integers.
To fetch the values i am using for loop. The problem is the increment index is 1 . I want to change it to 2. How is it possible ?

Please help me on this.
 
Ireneusz Kordal
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

this is described in documentation here:
http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/controlstructures.htm#CIHIIABG

Some languages provide a STEP clause, which lets you specify a different increment (5 instead of 1, for example).
PL/SQL has no such structure, but you can easily build one.
Inside the FOR loop, simply multiply each reference to the loop counter by the new increment.

Example 4-17 assigns today's date to elements 5, 10, and 15 of an index-by table.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic