This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes If and else statements in SQL Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "If and else statements in SQL Query" Watch "If and else statements in SQL Query" New topic
Author

If and else statements in SQL Query

Melvin Reynold
Greenhorn

Joined: Jun 12, 2009
Posts: 15
Im getting this error using Aqua Data Studio for below query. Thanks.

>[Error] Script lines: 1-13 -------------------------
ERROR: syntax error at or near "IF"
Line: 1

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32312
    
213

Melvin,
To the best of my knowledge, SQL doesn't have an if statement. Is that a database specific command/stored procedure? What database are you using?


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Melvin Reynold
Greenhorn

Joined: Jun 12, 2009
Posts: 15
Im using this statement in XML. For the database i think its DB2.
 
 
subject: If and else statements in SQL Query
 
It's not a secret anymore!