delete语句无效

rjzwgtxy  于 2021-07-26  发布在  Java
关注(0)|答案(0)|浏览(223)

我在windows平台上使用oracle19c。用户名和密码为hr/hr

try{  
        //step1 load the driver class  
        Class.forName("oracle.jdbc.driver.OracleDriver");  

        //step2 create  the connection object  
        Connection con=DriverManager.getConnection(  
        "jdbc:oracle:thin:@localhost:1521/orclpdb","hr","hr");  

        //step3 create the statement object  
        Statement stmt=con.createStatement();  

    int deletedRows = stmt.executeUpdate("DELETE FROM my_employee WHERE LAST_NAME LIKE '%man%'");
        if(deletedRows>0){
              System.out.println("Deleted Specific Row in the  table successfully...");
           }else{
             System.out.println("Not exist specific row that you select for delete");
          } 

        con.close();  

        }catch(Exception e){ System.out.println(e);}

不起作用。没有显示错误,没有语法错误。但这里的输出是:不存在您选择删除的特定行
在使用select*from my\ U employee后:这里是表行(delete语句无效):

EMPLOYEE_ID        FIRST_NAME           LAST_NAME                 DEPARTMENT_ID      SALARY

 -----------     --------------------   ------------------------- -------------  ----------

 1                asaamansad           asdamansda                      12       21312

但是相同的sql命令:

delete from my_employee where LAST_NAME LIKE '%man%';

这个可以在命令提示符或sqldeveloper上使用。在命令提示符上使用相同的sql命令时,上述行被删除。请解决这个问题。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题