java.sql.SQLException: ORA-00907: missing right parenthesis [message #17125] |
Fri, 24 December 2004 20:55 |
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 #17130 is a reply to message #17127] |
Sat, 25 December 2004 04:20 |
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 |
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
|
|
|
|