Home » SQL & PL/SQL » SQL & PL/SQL » java.sql.SQLException: ORA-00907: missing right parenthesis
java.sql.SQLException: ORA-00907: missing right parenthesis [message #17125] Fri, 24 December 2004 20:55 Go to next message
votey
Messages: 5
Registered: September 2002
Junior Member
Hi,

I'm running this command using JDBC, but got the following error message:

select id, score(1) from table1 where contains (content, ''keyword1'|'keyword2'', 1)>0
sql connection failed...

*** Java Stack Trace ***

java.sql.SQLException: ORA-00907: missing right parenthesis

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java)
at OracDriver.main(OracDriver.java:163)

*** SQLException caught ***

SQLState: 42000
Message: ORA-00907: missing right parenthesis

Error Code: 907

Actually I ran the same command many times a year ago, and it worked perfectly, in the same enviroment: Oracle 9i, one same unix machine.

Could any one please help me? Thanks a lot!
Re: java.sql.SQLException: ORA-00907: missing right parenthesis [message #17127 is a reply to message #17125] Sat, 25 December 2004 00:04 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Could you show us the piece of code where you define this statement?
Since you use both kind of quotes in your statement it is likely that the statement is truncated at either one of your quotes.

hth
Re: java.sql.SQLException: ORA-00907: missing right parenthesis [message #17130 is a reply to message #17127] Sat, 25 December 2004 04:20 Go to previous messageGo to next message
votey
Messages: 5
Registered: September 2002
Junior Member
Thank you for your reply, here is part of my code:

String query = "select id, score(1) from table1 where contains (content, "'keyword1'|'keyword2'", 1)>0";

ResultSet rset = stmt.executeQuery(query); // I got the error at this line

while (rset.next())
{
String docno = rset.getString(1);
int score = rset.getInt(2);
System.out.println(id + ", " + score);
}
Re: java.sql.SQLException: ORA-00907: missing right parenthesis [message #17133 is a reply to message #17130] Sat, 25 December 2004 06:30 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
You see ?
Your variable query is assigned the value
select id, score(1) from table1 where contains (content,
because here is (according to the Java interpreter) the closing double quote.

You have to escape the double quotes here. I'm not good enough in Java to tell you how to escape a double quote, but I'm sure it's out there on the big big net somewhere :)

hth
Re: java.sql.SQLException: ORA-00907: missing right parenthesis [message #17140 is a reply to message #17133] Sat, 25 December 2004 21:10 Go to previous message
votey
Messages: 5
Registered: September 2002
Junior Member
Thanks so much, got it!
Previous Topic: constraints after using IMP
Next Topic: External Tables and tab delimited files ...
Goto Forum:
  


Current Time: Thu Apr 18 02:10:16 CDT 2024