0

I'm using JDBC to connect to the Oracle database and ask how many methods are in the String class. I keep getting the following error:

Exception in thread "main" java.sql.SQLSyntaxErrorException: ORA-00936: missing expression 

at the following line:

ResultSet res1 = stmt.executeQuery("SELECT (Distinct method_name) FROM all_java_method WHERE name LIKE 'String' Order BY method_name");

I don't have a ton of experience with SQL yet so any help would be appreciated. Thanks.

2
  • 3
    try substitute (Distinct method_name) with Distinct method_name and 'String' with 'String%' or '%String%' Commented Feb 15, 2014 at 23:16
  • Awesome! it works now. Thanks! What made the difference? Commented Feb 15, 2014 at 23:21

1 Answer 1

2

Substitute (Distinct method_name) with Distinct method_name because that is the correct syntax for the SELECT
Also, you need to substitute 'String' with 'String%' or '%String%' (depends on what exactly are you wanna fetch, I don't know java, so...), otherwise it is logicaly become equal to name = 'String'

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.