db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hardie82 <thomas.harttha...@yahoo.de>
Subject NVL function implementation
Date Tue, 09 Mar 2010 15:18:06 GMT

Hi,

I want to implement the NVL-function for my derby-db to use sql-statement
once written for an informix-db. Therefor I began to write a function class
with methods like the following code:

  public static String nvl(String arg1, String arg2)
  {
    if(arg1 == null)
      return arg2;
    return arg1;
  }

I also create a function in sql:

CREATE FUNCTION NVL(arg1 VARCHAR(100), arg2 VARCCHAR(100)) returns
VARCHAR(100) language java 
external name 'mypackage.testdb.DerbyCustomFunctions.nvl' parameter style 
java no sql;

That works fine for statements with varchar-argument and length 100. But
what about other data-types like INTEGER or DATE? Have I to implement
methods for all data-type combination or is there a better way? Something
like a data-type converter for derby? I thought to get informations for
implementation from the nullif-function but can't find it in the derby-code.
-- 
View this message in context: http://old.nabble.com/NVL-function-implementation-tp27837153p27837153.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message