View Single Post

   
  #9 (permalink)  
Old 04-08-2008, 06:03 PM
--CELKO--
 
Posts: n/a
Default Re: loop through arrays in a stored procedure

>> .. it would take us 1 year to teach design of some pure SQL procedures that allow us to calculate some Loans including linear interpolation in a yield curve or applying some more complex math calc (including built-in functions like exp() and so on. <<

Or you could find a solution for NPV and IRR using auxiliary function
tables, a quick look at the details are in Chapter 22 of SQL FOR
SMARTIES. That is how people did it before calculators and cheap
computers. It also has the advantage of operating in parallel instead
of on a row-by-row basis, and you can avoid linear interpolation in
favor of a second delta interpolation so the results are more accurate.


The auxiliary table is loaded once and the programming is a simple
join. I doubt that it would take a year to do this

LISP and APL programmers understand SQL almost immediately. It is
procedural programmers that fall back to cursors and procedures when
they are firt learning. I have written five cursors in my career and I
know that if we had the CASE expression 15-20 years ago, I could have
avoided at least three of them.

Reply With Quote