agora inbox for pljava-dev@postgresql.org
help / color / mirror / Atom feedSubject: [Pljava-dev] Problem [SELECT - 0 row(s), 0.019 secs] [Error Code: 0, SQL State: 42601] ERROR: Default type java.math.BigDecimal cannot be replaced by int
Date: Mon, 21 Feb 2005 11:54:12 -0600
Message-ID: <1109008453.8649.7.camel@vpj.eevolution> (raw)
Hi all!
I have following case:
my Function:
/** Currency **/
CREATE OR REPLACE FUNCTION currencyBase (Amount DECIMAL,
C_CurrencyFrom_ID NUMERIC, ConversionDate Timestamp, AD_Client_ID
NUMERIC, AD_Org_ID NUMERIC)
RETURNS DECIMAL
AS
'org.compiere.sqlj.Currency.base(java.math.BigDecimal,int,java.sql.Timestamp,int,int)'
LANGUAGE java;
my CLASS FILE:
public static BigDecimal base (BigDecimal p_Amount,int
p_C_CurrencyFrom_ID, Timestamp p_ConversionDate,int p_AD_Client_ID,int
p_AD_Org_ID) throws SQLException
{
// Return NULL
if (p_Amount == null || p_C_CurrencyFrom_ID == 0)
return null;
// Return Amount
if (p_Amount.signum() == 0)
return p_Amount;
// Base Currency
String sql = "SELECT ac.C_Currency_ID "
+ "FROM AD_ClientInfo ci"
+ " INNER JOIN C_AcctSchema ac ON
(ci.C_AcctSchema1_ID=ac.C_AcctSchema_ID) "
+ "WHERE ci.AD_Client_ID=?";
int C_CurrencyTo_ID = Compiere.getSQLValue(sql, p_AD_Client_ID);
// Return Amount
if (p_C_CurrencyFrom_ID == C_CurrencyTo_ID)
return p_Amount;
//
return convert(p_Amount, p_C_CurrencyFrom_ID, C_CurrencyTo_ID,
p_ConversionDate, 0, p_AD_Client_ID, p_AD_Org_ID);
} // base
I execute my function:
SELECT currencyBase(o.GrandTotal,o.C_Currency_ID,o.DateAcct,
o.AD_Client_ID,o.AD_Org_ID) AS ConvAmt FROM C_Order o ;
but recieved this error: (Default type java.math.BigDecimal cannot be
replaced by int)
I think the problem is my o.C_Currency_ID is a type NUMERIC, but my
method as for int. I do not want to change all my methods.
Can You tell me How can I change to Default type or make some type of
mapping using pljava?
Victor P?rez Ju?rez
view thread (2+ messages) latest in thread
Message-ID: <1109008453.8649.7.camel@vpj.eevolution>
Permalink: ../1109008453.8649.7.camel@vpj.eevolution/
Also on: postgresql.org/message-id/1109008453.8649.7.camel@vpj.eevolution
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: pljava-dev@postgresql.org
Subject: Re: [Pljava-dev] Problem [SELECT - 0 row(s), 0.019 secs] [Error Code: 0, SQL State: 42601] ERROR: Default type java.math.BigDecimal cannot be replaced by int
In-Reply-To: <1109008453.8649.7.camel@vpj.eevolution>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox