Why does this plpgslq always return 1? - Mailing list pgsql-sql

From John Oakes
Subject Why does this plpgslq always return 1?
Date
Msg-id 002f01c11711$714d78b0$61b344ab@cisco.com
Whole thread Raw
Responses Re: Why does this plpgslq always return 1?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-sql
Can anyone tell me why this always return 1?  Thanks!

CREATE FUNCTION passrate(date, date, text) RETURNS float AS '

DECLAREbegindate ALIAS FOR $1;enddate ALIAS FOR $2;passfail ALIAS FOR $3; ret float;countp float;counttotal float;

BEGIN
SELECT INTO countp COUNT(*)FROM benchmarkWHERE passfail = passfail;
SELECT INTO counttotal COUNT(*)FROM benchmark;
ret := countp / counttotal;RETURN ret;
END;'
LANGUAGE 'plpgsql';


John



pgsql-sql by date:

Previous
From: Philip Warner
Date:
Subject: Re: Re: Restriction by grouping problem.
Next
From: Joel Burton
Date:
Subject: RE: Database Design Question