title: Mysql procedure sum
body: <p>I cannot remember how to do a basic <code>SUM</code> in a SQL proceedure, can anybody remind me quickly please?</p>
  
  <pre><code>drop procedure if exists pCaCalculateCcyFluc;
  delimiter //
  
  create procedure pCaCalculateCcyFluc(
    IN  pPrice                DECIMAL(10,6),
    IN  pPricePrev            DECIMAL(10,6),
    OUT pCcyFluc              DECIMAL(10,6)  
  )
  
  MODIFIES SQL DATA
  COMMENT 'calculate fluctuation'
  begin
  
    pCcyFluc = (pPricePrev - pPrice)/pPrice;
    --
  end;
  //
  
  delimiter ;
  </code></pre>