Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DB2 SQL error sqlcode=-104 sqlstate=42601

Tags:

sql

db2

I am relatively new to DB2 but not to SQL. I am experiencing the below error when trying a SELECT statement while subtracting a few minutes from a timestamp:

SELECT * TCCAWZTXD.TCC_COIL_DEMODATA 
WHERE CURRENT_INSERTTIME  BETWEEN(CURRENT_TIMESTAMP)-5 minutes AND CURRENT_TIMESTAMP

The error that I am experiencing is:

DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=TCCAWZTXD;SELECT*;, DRIVER=3.66.46

How can I fix this error?

like image 568
Lawrence Avatar asked Aug 11 '15 11:08

Lawrence


1 Answers

You miss the from clause

SELECT *  from TCCAWZTXD.TCC_COIL_DEMODATA WHERE CURRENT_INSERTTIME  BETWEEN(CURRENT_TIMESTAMP)-5 minutes AND CURRENT_TIMESTAMP
like image 143
Jens Avatar answered Sep 21 '22 12:09

Jens