Friday, December 1, 2017

java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement

Question:

I want to run the query: "DESCRIBE table_name;"
statement = this.connection.createStatement();
ResultSet rset = statement.executeQuery("DESCRIBE table_name");
and I got this error:
 " java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement"
what is the problem?

Answer:

describe user2.flights;
Here user2 is database name and flights is table name. Try this.
Or use next query
select *
  from user_tab_columns
 where table_name = 'MY_TABLE'
 order by column_id;  
Use this query.
column_id is the "order" of the column in the table.
You should ensure that 'MY_TABLE' is capitalized unless you've been adding tables with casing ( a bad idea ) in which case you need to use something like = "MyTable"

No comments:

Post a Comment