使用jdbc中的callableStatement通道链接数据库出现问题

**使用jdbc中的callableStatement通道链接数据库出现问题 **

控制台打印:请您输入员工id(批量删除员工-删除大于等于员工id的员工)
所有的业务逻辑以及SQL都写在存储过程内
存储过程返回一个删除成功或者删除失败的信息打印在控制台(日志)

Idea代码jdbc代码:

static void deleteEmpId(int id){
    Connection conn=null;
    CallableStatement cstmt=null;
    String anInt=null;
    try {
        conn=DriverManager.getConnection("jdbc:mysql:///query?useUnicode=true&characterEncoding=utf8",
                "root","123456");
        cstmt=conn.prepareCall("{call deleEmp(?,?)};");
        //同占位符传递参数
        cstmt.setInt(1,id);
        //通过占位符获取返回参数
        cstmt.registerOutParameter(2,Types.INTEGER);
        cstmt.execute();
        //获取第二个占位符对应类型的数据
        anInt=cstmt.getString(2);
        System.out.println(anInt);
        System.out.println("存储过程执行完成");
    } catch (SQLException e) {
        e.printStackTrace();
    }finally {
     //关闭流
        if(cstmt!=null){
            try {
                cstmt.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        if(conn!=null){
            try {
                conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

}

Datagrip代码存储过程代码

DELIMITER $

create procedure deleEmp(id int,out r varchar(20) char set utf8)
    begin
        declare ase int;
        select empId into ase  from emp where empId=id;
        while id=ase do-- 是否在数据表范围之内
            delete from emp where empId>=id;
            if asethen
                set  r='删除成功';
                else
                set r='删除失败';
            end if ;
            end while;
    end $

运行结果及报错内容
idea控制台输出的内容:

img


datagrip中的表数据:
emp表刷新前

img

emp表刷新后

img

                                     ** 效果达到了,但是控制台不显示提示语句;**

我想要达到的结果:
运行之后在控制台显示出数据库存储过程中out类型的输出语句