• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query Works in SQL, but Not in Java? [SOLVED]

 
Al Johnston
Ranch Hand
Posts: 99
Flex Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm not sure why I can't get this to work...

The code is:



If I copy and past this into SQL Query Manager, it works fine:



When I run this in Java, I get "java.sql.SQLException:... Incorrect syntax near "."... at OfferClicked.getTestLink(OfferClicked.java:203)"

Why does this work in SQL, but not Java? Your help is much appreciated.

Best,
Al
 
Al Johnston
Ranch Hand
Posts: 99
Flex Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind. I figured it out. Seems that there was not enough space between the values.

Changed it to:



Now it works.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For such long quires, you can always use string object to hold the query string.
like:


and you can edit and make the subject line as [SOLVED]... to let other know & save their time.
 
Al Johnston
Ranch Hand
Posts: 99
Flex Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sagar.

I will edit the forum topic.

Best,
Al
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic