Understanding mysterious Oracle JDBC errors - ORA-00911: invalid character

后端 未结 3 989
忘了有多久
忘了有多久 2020-12-09 15:50

I am making Java 1.6-JDBC-Oracle 11 code. I created a table called employee with id,name and age. I am getting the error - ORA-00911: invalid character. How can I fix this ?

相关标签:
3条回答
  • 2020-12-09 16:28

    Bohemian is exactly right. I don't see why this was so hard. If you pop the message into Google, you'll get this:

    http://www.dba-oracle.com/sf_ora_00911_invalid_character.htm

    The semi-colon is the first problem noted.

    Another recommendation: Don't do this.

    catch(SQLException e){System.out.println("Exception: " + e);}
    

    Do this instead:

    catch(SQLException e){
        e.printStackTrace(); // better yet, log it.
    }
    

    It'll give you lots more information.

    0 讨论(0)
  • 2020-12-09 16:50

    remove the ; from inside the query

    0 讨论(0)
  • 2020-12-09 16:55

    Try removing the semi colon from the end of your SQL statement.

    ie

    static String query = "SELECT emp_id, emp_name, emp_age " +
        "FROM employee"; // no trailing ";" in the SQL
    
    0 讨论(0)
提交回复
热议问题