sorry.It was rather silly.If we give incorrect number of parameters when we 
call the method via ALIAS,it gives us a method not found error.It worked 
wehn I gave the correct number of parameters.I did waste an evening of my 
time figuring this out though !

On Tuesday, December 8, 2015 at 9:28:24 PM UTC+1, Harish AS wrote:
>
> Hi,
>
> I am unable to run an ALIAS that i created.When I create an ALIAS it  gets 
> created sucessfully.However when I run the ALIAS it fails.Please see below
>
> First I create the ALIAS for a method called FIELDS which is in the 
> BasicFuntions class.
>
> sql> CREATE ALIAS RR FOR 
> "com.temenos.dbi.storedfunctions.BasicFunctions.FIELD"
> ;
> (Update count: 0, 4 ms)
>
>
> The creation of the ALIAS itself would fail if the class or the method 
> does not exist.(I have tested that).But in our case,it can identify both 
> and hence lets us create the ALIAS.
>
> But when I immediately run the alias with a call command it says the 
> Method cannot be found.Needless to say I have included the jar inside which 
> this class is present in the CLASSPATH.(That is why the ALIAS is created)
>
> sql> call RR();
> Error: org.h2.jdbc.JdbcSQLException: Method "FIELD 
> (com.temenos.dbi.storedfunct
> ions.BasicFunctions, parameter count: 0)" not found; SQL statement:
> call RR() [90087-172]
>         at 
> org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
>         at org.h2.message.DbException.get(DbException.java:169)
>         at org.h2.message.DbException.get(DbException.java:146)
>         at 
> org.h2.engine.FunctionAlias.findJavaMethod(FunctionAlias.java:255)
>         at org.h2.expression.JavaFunction.<init>(JavaFunction.java:33)
>         at org.h2.command.Parser.readJavaFunction(Parser.java:2151)
>         at org.h2.command.Parser.readFunction(Parser.java:2190)
>         at org.h2.command.Parser.readTerm(Parser.java:2500)
>         at org.h2.command.Parser.readFactor(Parser.java:2062)
>         at org.h2.command.Parser.readSum(Parser.java:2049)
>         at org.h2.command.Parser.readConcat(Parser.java:2022)
>         at org.h2.command.Parser.readCondition(Parser.java:1887)
>         at org.h2.command.Parser.readAnd(Parser.java:1868)
>         at org.h2.command.Parser.readExpression(Parser.java:1860)
>         at org.h2.command.Parser.parseCall(Parser.java:4038)
>         at org.h2.command.Parser.parsePrepared(Parser.java:326)
>
>
> I hav also checked that the class is a public class and the method is a 
> static public method.
>
> package com.temenos.dbi.storedfunctions;
>
> import java.io.CharArrayWriter;
> import java.io.IOException;
> import java.math.BigDecimal;
> import java.math.RoundingMode;
> import java.sql.Blob;
> import java.sql.Clob;
> import java.text.DecimalFormat;
> import java.text.Format;
> import java.text.ParseException;
> import java.text.SimpleDateFormat;
> import java.util.Arrays;
> import java.util.Calendar;
> import java.util.Date;
> import java.util.StringTokenizer;
> import java.util.TimeZone;
> import java.util.Vector;
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
>
> //import com.temenos.j24.common.PreciseDecimal;
> //import com.temenos.j24.common.Util;
> //import com.temenos.j24.common.jVar;
> //import com.temenos.j24.common.jVarData;
> //import com.temenos.j24.common.jVarFactory;
>
> public class BasicFunctions {
>
> /*
>      * @derby CREATE FUNCTION j24field (param1 VARCHAR(30000), param2
>      * VARCHAR(10), param3 VARCHAR(10), param4 VARCHAR(10)) RETURNS LONG 
> VARCHAR
>      * PARAMETER STYLE JAVA NO SQL LANGUAGE JAVA EXTERNAL NAME
>      * 'com.temenos.dbi.storedfunctions.BasicFunctions.FIELD';
>      */
>     public static String FIELD(String sStr, String sSeparator, String 
> sOccurence, String sCount) {
>         return fGet(sStr, sSeparator, sOccurence, sCount);
>     }
>
> The jar is not present in h2*.jar but another jar called TAFJFunctions.jar 
> fyi
> Cheers,
> harish
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to