From: | jc_mich <juan(dot)michaca(at)paasel(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | PL/PGSQL arithmetic errors |
Date: | 2009-03-30 23:55:19 |
Message-ID: | 22795583.post@talk.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all!
I'm developing an algorithm with PL/PGSQL using statistical operations from
a table. I have several differences between expected results and the results
generated by the function.
I want to know if there are differences in arithmetic operation sintax or if
there's any special arithmetical operators precedence between pl/pgsql and
other languages.
My code looks like this:
FOR iterator1 IN SELECT period, AVG(col1) AS avg_col1, STDDEV(col1) AS
dev_col1, AVG(col2) AS avg_col2, STDDEV(col2) AS dev_col2 FROM scheme.table
GROUP BY period ORDER BY period LOOP
FOR iterator2 IN SELECT period, id, col2, col1 FROM scheme.table WHERE col1
IS NOT NULL LOOP
IF grav = 0 THEN
_standata := (iterator2.col1 - iterator1.avg_col1) / iterator1.dev_col1;
ELSE
_standata := (iterator2.col2 - iterator1.avg_col2) / iterator1.dev_col2;
END IF;
UPDATE scheme.table SET standata = _standata WHERE id = iterator2.id AND
period=iterator2.period;
_standata := 0.0;
END LOOP;
END LOOP;
Thanks!
--
View this message in context: http://www.nabble.com/PL-PGSQL-arithmetic-errors-tp22795583p22795583.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Eric Smith | 2009-03-31 00:43:12 | Re: running two servers on one machine |
Previous Message | Michael Glaesemann | 2009-03-30 22:52:32 | Re: i have a problem with judge some words contain chinese word! |