I have modified our TRUNC implementation so that we support doing TRUNC(timestamp).

If you want to extend it to support Oracle better (i.e. the second parameter), feel free to hack on the code in org.h2.expression.Function and send in patches :-)

The change will be in the next version, or you can get it tomorrow from the nightly build.

On 2013-03-13 16:49, Marco Brade wrote:
Hello
we use h2 as test database as an oracle emulation.
With version 1.3.167 an new alias was introduced trunc as alias of truncate. This alias prevents us to create our own alias trunc which is an method in oracle. Its also not possible to remove this alias. Please get the following sql work again right now the first drop does not work and the create throws an exception.
drop ALIAS trunc;
commit;
CREATE ALIAS trunc as '
import java.text.*;
import java.util.*;
@CODE
java.util.Date trunc(java.sql.Timestamp timeStamp)  throws Exception {
        Calendar c = Calendar.getInstance();
        c.setTime(new Date(timeStamp.getTime()));
        c.set(Calendar.HOUR, 0);
        c.set(Calendar.MINUTE, 0);
        c.set(Calendar.SECOND, 0);
        c.set(Calendar.MILLISECOND, 0);
        return  c.getTime();
} ';
Or if database is in oracle mode remove the alias.
// Marco
--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to