Skip site navigation (1) Skip section navigation (2)

Re: Function Error

From: Michael Wood <esiotrot(at)gmail(dot)com>
To: Susan M Farley <sfarley1(at)gmu(dot)edu>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Function Error
Date: 2010-02-23 16:58:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On 23 February 2010 16:58, Susan M Farley <sfarley1(at)gmu(dot)edu> wrote:
> I'm trying to import a function in Java, but am having problems with it. The java function is
> public static double chi2cdf (double x)
> {
>  return chi.cdf(x);
> }
> I copied the sim.class file to the Postgres data directory and I added it to Postgres with the following
> select sqlj.replace_jar('file:///D:/workspace/SimplePrediction/sim.jar','sim',true);
> SELECT sqlj.set_classpath('public', 'sim');
> CREATE OR REPLACE FUNCTION sim.chi2cdf(double precision)
>                 RETURNS double precision
>                 AS 'simpleMonteCarlo.sim.chi2cdf'
>                 LANGUAGE java;
> When I try to run it, I get the following error:
> ERROR:  Unable to find static method simpleMonteCarlo.sim.chi2cdf with signature (D)D
> I thought it was the signature of double precision, but then tried it with two other functions, one a float and one a int. Does anyone have any ideas?

Just a guess, but what happens when you use Doubles instead of doubles?  i.e.:

public static Double chi2cdf (Double x)
    return chi.cdf(x);

Michael Wood <esiotrot(at)gmail(dot)com>

In response to

pgsql-novice by date

Next:From: dipti shahDate: 2010-02-23 17:15:37
Subject: Re: Minor systax error but not able to resolve it...
Previous:From: Tom LaneDate: 2010-02-23 15:53:55
Subject: Re: Minor systax error but not able to resolve it...

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group