What can SQL CODE -104 (error) represent?

95,162

Solution 1

You have a comma (where you shouldn't) at the end of this line:

AND Tick.STATE IN (1,2,3,10,1),

The following line also has the same problem.

Solution 2

Generally this SQL error code denotes that you have inserted some extra characters, such as ',' or '(' or ')' or kind of. Checking the complete query in the trace will help for the people who write Sql queries inside a Java Program or such, as it took around 2 hours for me to figure out that I have a extra ')' in my query.

Share:
95,162

Related videos on Youtube

Bernice
Author by

Bernice

Mostly interested in web development and Java. life motto: while(!successful) { tryAgain(); }

Updated on July 09, 2022

Comments

  • Bernice
    Bernice almost 2 years

    I am executing an SQL query via jcc to run a report. When I opened the error log file for the program and examined the SQL query, everything seems to be fine (There are no extra or missing brackets, commas, etc and the syntax is good) however when I execute I am getting this error:

    [Report.execute()] DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=,;ATE IN (1,2,3,10,1) ;, DRIVER=4.12.55

    When I researched about the SQLCODE I found out that it means there is an illegal symbol in the query. What can I look for to find this illegal symbol?

    This is the query

    enter image description here

    Sorry for the tiny font but if you zoom 200% or so you can see the query better.

    Thanks a lot :)

  • Bernice
    Bernice about 11 years
    oh! sorry I'm still new to this! I thought that wasn't bad! Thanks for your help!
  • valijon
    valijon almost 5 years
    In my case it was a ; at the end of query
  • Smart Coder
    Smart Coder over 3 years
    I had extra unnecessary ; at the end.

Related