Jdbctemplate query for string: EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0

前端 未结 17 1225
执笔经年
执笔经年 2020-11-29 16:22

I am using Jdbctemplate to retrieve a single String value from the db. Here is my method.

    public String test() {
        String cert=null;
        Strin         


        
17条回答
  •  清酒与你
    2020-11-29 17:10

    For Byron, you can try this..

    public String test(){
                    String sql = "select ID_NMB_SRZ from codb_owner.TR_LTM_SLS_RTN 
                         where id_str_rt = '999' and ID_NMB_SRZ = '60230009999999'";
                    List li = jdbcTemplate.queryForList(sql,String.class);
                    return li.get(0).toString();
            }
    

提交回复
热议问题