• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

DATEADD in JDBC template

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying a query select with jdbc and spring boot,

I want select informations where my creation date value is LESS than now minus 30.

I tried like this :



I have an error like this :




Anyone has idea ? Thanks
 
Marshal
Posts: 72913
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know. What happens when you run that query from the command line/terminal?
Moving to our databases and Spring fora.
 
Gerard Geded
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Don't know. What happens when you run that query from the command line/terminal?
Moving to our databases and Spring fora.



In SQL Console that's work, but in my java code no...
 
Marshal
Posts: 3557
505
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gerard Geded wrote:I tried like this :


Can you show the actual code where this is used?
 
Gerard Geded
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:

Gerard Geded wrote:I tried like this :


Can you show the actual code where this is used?



This code works with console SQL :

 
Ron McLeod
Marshal
Posts: 3557
505
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The concatenated string will be:with no space between information and WHERE
 
Gerard Geded
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:The concatenated string will be:with no space between information and WHERE




No looks my screenshot, this part it's OK, the problem is with the DATE but i don't know what exactly
sql.PNG
[Thumbnail for sql.PNG]
 
Ron McLeod
Marshal
Posts: 3557
505
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This:
and this:


are obviously not the same.  One has a table name of information, the other has UsersAccount.
 
Gerard Geded
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:This:
and this:


are obviously not the same.  One has a table name of information, the other has UsersAccount.



Considered the last screenshot it's good, sorry for the confuse
 
Bartender
Posts: 2085
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I notice this lastTreatment =< Now() - INTERVAL 30 MINUTE.
Should it be lastTreatment < NOW() - INTERVAL 30 MINUTE ?
 
Campbell Ritchie
Marshal
Posts: 72913
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, now you come to mention it, should there be a space between the = and < characters? That doesn't look right.
 
Ron McLeod
Marshal
Posts: 3557
505
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is =< a valid comparison operator?  Shouldn't it be <= ?
 
Get off me! Here, read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic