Hi Bala,

I am not sure that this is what you want. However, Derby already has builtin functions for pi and e. They are called pi() and exp(). So, for instance, the following statement returns pi and e:

  values (pi(), exp(1));

See the Derby reference manual's sections on these builtin functions: http://db.apache.org/derby/docs/10.11/ref/rrefsqlj29026.html

If you want to use other constants in queries, then I don't know of any better solution than implementing your own functions to return those constants. You may want to declare those functions as DETERMINISTIC so that Derby will know that they can be used in situations which require constant inputs.

Hope this helps,
-Rick

On 4/24/15 4:15 AM, BalNagendra wrote:
Hi Rick,

Thanks for your advice. I have been able to add some Java libraries into Derby. It is working fine. Now the question is how to read Java variables like PI, E into Derby.

thanks and regards

Bala Nagendra

On Wed, Mar 4, 2015 at 2:54 AM, Rick Hillegas-3 [via Apache Database] <[hidden email] </user/SendEmail.jtp?type=node&node=143967&i=0>> wrote:

    On 3/2/15 10:45 PM, BalNagendra wrote:

    > Dear All,
    >
    > I am having the following problem:
    >
    > Derby is good but functions which are available for database are
    not many.
    >
    > I wanted to dump a character of its Hex value, there was no
    function. I had
    > to write a Java Program to do the same. It is a tedious process
    of loading
    > the function JAR to database and they create a database mapping
    to it.
    >
    > Java has rich set of functions under Math, IO and UTIL
    libraries. Is there
    > any way to use them as Derby Library. I was trying to avoid
    mapping each of
    > these functions to Derby functions.
    >
    > Thanks and regards
    >
    >
    >
    > --
    > View this message in context:
    
http://apache-database.10148.n7.nabble.com/Derby-How-to-enrich-database-functions-with-Java-Library-tp143832.html
    > Sent from the Apache Derby Developers mailing list archive at
    Nabble.com.
    >
    This is an interesting problem. Take a look at the code which
    implements
    the databaseMetaData optional tool:
    http://db.apache.org/derby/docs/10.11/tools/rtoolsoptdbmetadata.html
    That code introspects a Java interface and declares functions and
    table
    functions for all of the methods in the interface.

    You may hit some speed bumps with methods which take Object
    parameters.
    But, provided that those Objects implement Serializable, you
    should be
    able to declare user-defined types for them.

    Hope this helps,
    -Rick


    ------------------------------------------------------------------------
    If you reply to this email, your message will be added to the
    discussion below:
    
http://apache-database.10148.n7.nabble.com/Derby-How-to-enrich-database-functions-with-Java-Library-tp143832p143833.html

    To unsubscribe from Derby - How to enrich database functions with
    Java Library, click here.
    NAML
    
<http://apache-database.10148.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




------------------------------------------------------------------------
View this message in context: Re: Derby - How to enrich database functions with Java Library <http://apache-database.10148.n7.nabble.com/Derby-How-to-enrich-database-functions-with-Java-Library-tp143832p143967.html> Sent from the Apache Derby Developers mailing list archive <http://apache-database.10148.n7.nabble.com/Apache-Derby-Developers-f4.html> at Nabble.com.

Reply via email to