Dear all,
i try to do a little weighting of my data by using a stored procedure. Basically this means multiplying certain columns with their respective weights and adding them up in the end. I have written the following stored procedure:
CREATE PROCEDURE test ()
BEGIN
DECLARE w1 DOUBLE;
DECLARE w2 DOUBLE;
DECLARE res1 DOUBLE;
DECLARE res2 DOUBLE;
DECLARE finres DOUBLE;
SELECT weight1 INTO w1 FROM weights;
SELECT weight2 INTO w2 FROM weights;
SELECT w1 * var1 INTO res1 FROM vartable;
SELECT w2 * var2 INTO res1 FROM vartable;
SELECT res1+res2 INTO finres;
SELECT MEAN(finres);
END
//
Unfortunately it does not do the trick yet. In the end it should return one value, but all of this only works if i put all the vars to the SELECT query. Thx in advance for any suggestions!