Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I am almost new to DB2 but not to SQL. I am encountering the below error when attempting 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

Below is the error that I am getting:

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

How can I fix this error?

1 Answer

0 votes
by (12.7k points)
edited by

Here, In the statement which you had mentioned above, you're missing the from clause.

So it should be like this,

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

Looking for a SQL Tutorial? Join the SQL Course to gain more knowledge on SQL.

Related questions

0 votes
1 answer
asked Jan 5, 2021 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Dec 17, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Dec 2, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer

Browse Categories

...