Hello i got a Problem i alway get the same Error. In SQL itself it works but not in Java unfortunately
java.sql.SQLSyntaxErrorException: ORA-00933: SQL-Befehl wurde nicht korrekt beendet
My Code:
import java.sql.*;
class verbindung2{
public static void main(String args[]){
try{
//step1 load the driver class
Class.forName("oracle.jdbc.driver.OracleDriver");
//step2 create the connection object
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@//pgbtf-cluster-test.company.de:1521/pgbtf.company.de","testuser","test123");
//step3 create the statement object
Statement stmt=con.createStatement();
//step4 execute query
ResultSet rs=stmt.executeQuery("select DOK_ID , ID, AKTEN_ID , TITEL , DOK_TYP , DOK_ART , ERSTELL_DAT , EING_DAT , DOK_MIME_TYPE from patgbmf.supi where DOK_MIME_TYPE='application/pdf' , OFFSET 20 ROWS FETCH NEXT 20 ROWS ONLY;");
while(rs.next())
System.out.println(rs.getString(1)+" "+rs.getString(2)+" "+rs.getString(3));
//step5 close the connection object
con.close();
}catch(Exception e){ System.out.println(e);}
}
}
1 Answer 1
I had this problem too. This can be solved by removing the semicolon at the end of the query statement. The semicolon will be added automatically during execution and Oracle does not accept the resulting duplicate semicolon. check here
Sign up to request clarification or add additional context in comments.
Comments
default
OFFSET.;creating problems?