15

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?

1
  • 1
    Side note: you generally shouldn't be using SELECT *. Explicitly list out the columns you're interested in. Commented Aug 11, 2015 at 12:54

1 Answer 1

22

You miss the from clause

SELECT *  from TCCAWZTXD.TCC_COIL_DEMODATA WHERE CURRENT_INSERTTIME  BETWEEN(CURRENT_TIMESTAMP)-5 minutes AND CURRENT_TIMESTAMP
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.