Why does this plpgslq always return 1?

From: "John Oakes" <john(at)networkproductions(dot)net>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Why does this plpgslq always return 1?
Date: 2001-07-28 03:00:21
Message-ID: 002f01c11711$714d78b0$61b344ab@cisco.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Can anyone tell me why this always return 1? Thanks!

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

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

BEGIN

SELECT INTO countp COUNT(*)
FROM benchmark
WHERE passfail = passfail;

SELECT INTO counttotal COUNT(*)
FROM benchmark;

ret := countp / counttotal;
RETURN ret;
END;'
LANGUAGE 'plpgsql';

John

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Joel Burton 2001-07-28 03:22:50 RE: Database Design Question
Previous Message María Elena Hernández 2001-07-28 01:36:35 Get name of columns in a table