当前所在位置:珠峰网资料 >> 计算机 >> Oracle认证 >> 正文
oracle存储过程的基本语法及注意事项(五)
发布时间:2010/10/6 10:28:08 来源:www.xue.net 编辑:城市总裁吧
   如果在存储过程中,使用如下语句:

  select sum(vcount) into fcount from A where bid='xxxxxx';

  如果A表中不存在bid="xxxxxx"的记录,则fcount=null(即使fcount定义时设置了默认值,如:fcount number(8):=0依然无效,fcount还是会变成null),这样以后使用fcount时就可能有问题,所以在这里最好先判断一下:

  if fcount is null then

  fcount:=0;

  end if;

  这样就一切ok了。

  6.Hibernate调用oracle存储过程

  this.pnumberManager.getHibernateTemplate().execute(

  new HibernateCallback() ...{

  public Object doInHibernate(Session session)

  throws HibernateException, SQLException ...{

  CallableStatement cs = session

  .connection()

  .prepareCall("{call modifyapppnumber_remain(?)}");

  cs.setString(1, foundationid);

  cs.execute();

  return null;

  }

  });

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved