Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

append data to an existing column. - help

 
isabella swan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a date column in the database, i want to add some time(few minutes ) and update.
In a single update query i want to update all the date columns, an anyone please let me know the query.

Thanks in advance.
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using JPA, JPQL does not define any date functions for adding time. "+" can be used for numerics, so you could try that for a date, it is possible it may work depending on your database/JPA provider.
With Oracle and EclipseLink you can just use + 1 in JPQL to add days to a date. + (1/24) adds an hour in Oracle.



You can use a native SQL query, the syntax for the date function will depend on your database.
In SQL Server the DATEADD function can be used for this. In EclipseLink you can use the FUNC function to use a native database function in JPQL.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic