Thomas McKiernan <[email protected]> writes: > Hi all, > > Perhaps someone can help me. > > I am currently adding a unit test framework to some existing code. > > In production, the code uses Oracle DB and the JDBC SQL statements make > extensive use of Oracle’s “SYSDATE’. > > For various reasons we are trying to use Derby instances when unit testing the > code. > > Obviously we would expect there to be some differences between the two DBs and > the main one for us seems to be that Derby does not understand the SYSDATE > function – we see the following error when performing ‘update some_table > set…some_column=SYSDATE’…where…: > > java.sql.SQLSyntaxErrorException: Column 'SYSDATE' is either not in any table > in the FROM list or appears within a join specification and is outside the > scope of the join specification or appears in a HAVING clause and is not in > the GROUP BY list. If this is a CREATE or ALTER TABLE statement then > 'SYSDATE' is not a column in the target table. > > I do not want to refactor the existing code *if* it can be helped. > > Is there a way I can get Derby to understand SYSDATE in a similar fashion to > Oracle? Or a neat trick I can do so that the SQL statements stay more-or-less > the same?
Hi Thomas, Could you use CURRENT_TIMESTAMP instead of SYSDATE? CURRENT_TIMESTAMP is supported by both Oracle and Derby, I think. -- Knut Anders
