I am new to programming in ruby. I was trying to write a method that will display my query results on screen in the format that I want it in. below is my script:
#!/usr/bin/ruby
def getbatch( batchno )
sql = "
SELECT *
FROM feecalc.payments
WHERE batchnumber = '#{batchno}'"
Db.doQuery('acctdb',sql ).each do|r|
puts r['checkno']
puts r['datepaid']
puts r['checkamount']
puts r['Gross']
puts r['Credit_Fee']
puts r['ProcessFee']
puts r['CB/ReturnChkFee']
puts r['Reserves']
end
end
Can anyone tell me what I am doing wrong because when I run the script, nothing is printed on screen.
#!/usr/bin/ruby
def getbatch( batchno )
sql = "
SELECT *
FROM feecalc.payments
WHERE batchnumber = '#{batchno}'"
Db.doQuery('acctdb',sql ).each do|r|
puts r['checkno']
puts r['datepaid']
puts r['checkamount']
puts r['Gross']
puts r['Credit_Fee']
puts r['ProcessFee']
puts r['CB/ReturnChkFee']
puts r['Reserves']
end
end
Can anyone tell me what I am doing wrong because when I run the script, nothing is printed on screen.