From: Daniel DeLorme Date: 2006-07-20T13:35:02+09:00 Subject: Re: Ruby + oracle last row 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< 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