这条sql语句 update TB_SELF_CUSTOMER set n_state=0 ,n_audit_state=0 where n_self_customer_id=?  为什么在数据库里更新可以用,在程序里就报错  ORA-01722: 无效数字 ; nested exception is java.sql.SQLException: ORA-01722: 无效数字! 谁能帮看下

解决方案 »

  1.   

     n_self_customer_id 这个你后面的?要传入数字  不能是字符串,你看下你传入的值是多少
      

  2.   

    n_self_customer_id传过来的参数在数据库中有么??
      

  3.   

    看看你给?号传参的代码,应该是ps.setInt(xxx);
    而不能是ps.setString(xxx);之类的
      

  4.   

    万一人家用的是 hibernate   hql  写的  就直接? 没有问题吧
      

  5.   

    用的jdbc连接  List paramList = new ArrayList();          
    StringBuffer sql = new StringBuffer();

    if (params.get("selfcustomerid") != null
    && ((String) params.get("selfcustomerid")).length() > 0) {
    sql.append("update TB_SELF_CUSTOMER  set n_state=0 ,n_audit_state=0  where n_self_customer_id=?  \n");
    paramList.add(params.get("selfcustomerid"));
    }
    jdbc.execute(sql.toString(), paramList.toArray());都在这里了
      

  6.   

      params.get("selfcustomerid")这个的返回值类型有问题。不是数字。
      

  7.   

    晕,数据库里n_self_customer_id定义的数值型,
    paramList里面add的根本就不是int型。还说不可能先试试
    jdbc.execute(sql.toString(), new int[]{357});
      

  8.   

    哦  这样呀 
    sql.append("update TB_SELF_CUSTOMER set n_state=0 ,n_audit_state=0 where n_self_customer_id=? \n");
    paramList.add(params.get("selfcustomerid"));
    错了sql.append("update TB_SELF_CUSTOMER set n_state=0 ,n_audit_state=0 where n_self_customer_id=");
    sql.append(" '" + 你要传的值+ "' ");
      

  9.   

    sql.append("update TB_SELF_CUSTOMER set n_state=0 ,n_audit_state=0 where n_self_customer_id=? \n");
    去掉末尾的 \n 试试