ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Möller <dcmoel...@gmx.de>
Subject RE: How to use system date
Date Mon, 09 Jul 2007 09:40:03 GMT

JDBC 3.0 implements a feature called "Escape Syntax": Something like

{foo FUNCTION()}

to set in your SQL statement. It provides you with the ability to access
database specific functions in a general, database-independent way.

You will find further information in the JDBC 3.0 spec, chapter 13.4 and
appendix C (especially appendix C3 "Time and Date Functions"):

Getting current system timestamp works like this:

select * from TABLE where TIMESTAMP_FIELD < {fn CURTIME()}

Or with current date:

insert into TABLE (VARCHAR_FIELD, DATE_FIELD) values ('Some characters',
{fn CURDATE()})

Checking support of this feature by your JDBC driver is possible via

Hopefully your vendor supports it.


Christian Möller

View raw message