Faby wrote: > Hi all, > I am new to ruby so any help will be greatly appreciated. > I am using ruby with oracle, and the following text is an extract of my > programm. (A cursor is fecthing the rows of a sql query.) > > while row=cursor.fetch > if(row[0]<4) > outputFile<<row[0].to_s+"\t"+row[1].to_s+"\n" > elsif (row[0]>=4) > totalRow4+=row[1] > end > end When I need a look-ahead I sometimes do something like this: nextrow = cursor.fetch while row=nextrow nextrow = cursor.fetch if nextrow.nil? p row #print last row end end Daniel