John Park
John Park

Reputation: 290

getting java.sql.SQLSyntaxErrorException: ORA-00936: missing expression error

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.

Upvotes: 0

Views: 2935

Answers (1)

Alexander
Alexander

Reputation: 3179

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'

Upvotes: 2

Related Questions