How to call one value from stored procedure using ruby -


i want call 1 value database stored procedure. procedure ibaccountlist) is:

select ac.cuaccountid, ac.accountnumber, ac.balancedate, p.description, ac.parentaccountid, p.producttypeid, case p.producttypeid when 1      dbo._balance(ac.dramount, ac.cramount) * -1  else      dbo._balance(ac.dramount, ac.cramount)  end balance,  case p.producttypeid when 1      null  else (     select dbo._balance(intr.dramount, intr.cramount)      cuaccount intr     intr.parentaccountid = ac.cuaccountid )  end interest   cuaccount ac inner join cuproduct p on ac.productid = p.productid  customerid = @customerid , ac.active = 1 , ac.parentaccountid null  order ac.accountnumber 

i wish producttypeid stored procedure. how reference in ruby. i'm trying following:

def fetch_account_type(number)   @accounttype = @db.call('ibaccountlist', @id).map |accounttype|   {accounttype: accounttype['producttypeid']}   end end 


Comments