pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Oakes <john@networkproductions.net>
To: pgsql-sql@postgresql.org
Subject: Why does this plpgslq always return 1?
Date: Fri, 27 Jul 2001 20:00:21 -0700
Message-ID: <002f01c11711$714d78b0$61b344ab@cisco.com> (raw)

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




view thread (3+ messages)  latest in thread

Message-ID: <002f01c11711$714d78b0$61b344ab@cisco.com>
Permalink:  ../002f01c11711$714d78b0$61b344ab@cisco.com/
Also on:    postgresql.org/message-id/002f01c11711$714d78b0$61b344ab@cisco.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: john@networkproductions.net
  Subject: Re: Why does this plpgslq always return 1?
  In-Reply-To: <002f01c11711$714d78b0$61b344ab@cisco.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox