SQL语句结尾处多加了一个分号,导致出现 ------ORA-00911: 无效字符---错误


String sql = "select * from (select USER_ID,USER_NAME,FACEADDRESS,rownum as no FROM ((SELECT STUDENT_ID USER_ID,STUDENT_NAME USER_NAME,FACEADDRESS FROM XTGL_STUDENT WHERE student_name LIKE ? OR STUDENT_ID LIKE ? ) UNION(SELECT TEACHER_ID USER_ID,TEACHER_NAME USER_NAME,FACEADDRESS from XTGL_TEACHER WHERE TEACHER_NAME LIKE ? OR TEACHER_NAME LIKE ? )) )x WHERE (x.no <= "
+ Integer.parseInt(pagesize)
* Integer.parseInt(pagenum)
+ " and x.no > "
+ Integer.parseInt(pagesize)
* (Integer.parseInt(pagenum) - 1) + ") ;";

SQL语句结尾处多加了一个分号,导致出现 ------ORA-00911: 无效字符---错误

oracle数据库连接工具plsql能够识别这个分号,把他当做这句sql语句的结束符,但是在java编译器中就会提前结束这个sql语句,导致出现ORA-00911错误;



你可能感兴趣的:(JAVA,SQL)