1
ResultSet resultObj = statementObj.executeQuery("SELECT EMPLOYEE_ID FROM JOB_HISTORY WHERE START_DATE > Convert(datetime, '2001-01-13' )");

I get this error while Iam executing the program:

java.sql.SQLSyntaxErrorException: ORA-00904: "DATETIME": invalid identifier

1

3 Answers 3

2

If you are using Oracle, use Oracle syntax:

SELECT EMPLOYEE_ID
FROM JOB_HISTORY
WHERE START_DATE > DATE '2001-01-13';

The date keyword allows you to use ISO-standard syntax for date constants.

Sign up to request clarification or add additional context in comments.

1 Comment

It would be more flexible to use a prepared statement and not worry about what format the DB actually wants. Leave the detail work to the JDBC driver, thats its job.
0

Try this:

ResultSet resultObj = statementObj.executeQuery("SELECT EMPLOYEE_ID FROM JOB_HISTORY WHERE START_DATE > '2001-01-13'");

Comments

0

try this

Query ="SELECT EMPLOYEE_ID FROM JOB_HISTORY WHERE START_DATE >'2001-01-13' ";
ResultSet resultObj = statementObj.executeQuery(Query);

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.