Search Postgresql Archives

using a function in where

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All,
I am using the function below to convert a continuous variable to a binned value.  Sometimes a value other than zero is passed through the query. For example -.5 result value is passed to the query result.  The basic of the query is below.  

select
incentivebin(wac, rate, .25)
from
my_table
where incentivebin(was, rate, .25) = 0

I have checked the function works correctly and the raw values match those values expected from simple subtraction and are in the correct bin.  I am not sure why some values would be allowed through the query. Any ideas would be appreciated.

Best,
Glenn


CREATE or REPLACE FUNCTION embs_owner.IncentiveBin(IN "Gwac" double precision, 
  IN "MtgRate" double precision, 
  IN "BinSize" double precision)
    RETURNS double precision
    LANGUAGE 'sql'
    PARALLEL SAFE
AS 'select ceiling(($1 - $2)/$3) *$3';

ALTER FUNCTION embs_owner.IncentiveBin(double precision, double precision, double precision)
    OWNER TO embs_owner;


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux