易截截图软件、单文件、免安装、纯绿色、仅160KB

hibernate根据时间日期来查询oracle数据库

使用模糊查询:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); 
Date startdate = sdf.parse(start_date);
Date enddate = sdf.parse(end_date);
List list = sess.createCriteria(MyTabel.class)
               .add( Restrictions.eq("clinid", start_clinId) )
               .add( Restrictions.between("idate", startdate, enddate) ) .list();
使用oracle本身的函数
session.find("from Weather w where w.recordTiime=to_date('"+ datestr +"', 'yyyy-mm-dd hh24:mi:ss')")
其中datestr是形如"2005-03-01 11:30:00"格式的字符串
Spring集成hibernate
public List findResult(final String bankid,final String begintime,final String endtime) {
   log.debug("finding Result Ydopehb instances");
   java.util.Date bd=DateUtil.getDate(begintime);
   java.util.Date ed=DateUtil.getDate(endtime);
  
  
  
   java.sql.Date bdate = new java.sql.Date(bd.getTime());  
   java.sql.Date edate = new java.sql.Date(ed.getTime());
   try {
    String queryString = "from Ydopehb where bankid='"
     + bankid +"' and feetime between :begintime and :endtime ";
    
   
    return getHibernateTemplate().findByNamedParam(queryString, new String[]{"begintime","endtime"}, new java.sql.Date[]{bdate,edate}) ;
   } catch (RuntimeException re) {
    log.error("find Result failed", re);
    throw re;
   }
}
其中DateUtil 是自定义的工具类,用来在Date类型和String类型之间互相转换。


相关文档:

Oracle用户、角色、权限和系统资源管理常用操作

查询用户信息
SELECT USERNAME,DEFAULT_TABLESPACE, TEMPORARY_TABLESPACE, PROFILE, ACCOUNT_STATUS, CREATED from dba_users; 查询用户空间使用和上限情况
SELECT username, tablespace_name, bytes/1024/1024 space_used_in_mb, max_bytes/1024/1024 max_space_in_mb from dba_ts_quotas; 创建 ......

Oracle 四舍五入函数

ceil(number)   大于或等于的最小整数  
  floor(number)   小于或等于的最大整数  
  trunc(number,m)   在整数number的m位置截掉m及以后的位数:  
  如:trunc(15.78,1)=15.7    
        trunc(15.78,-1)=15;  
  round ......

oracle复习(二) 之Oracle实例的管理

      今天复习第三章,本来算起来应该是第二章的,但是第二章的内容是介绍数据库的管理工具,而对于我们而言,这些相对来说没有多大的必要,所以,现在步入复习Oracle实例的管理。这章的内容包括初始化参数文件的维护和管理,以各种不同的方式启动和概念比数据库Oracle Instance,以及对Oracle I ......

ORACLE 一致读(Consistent Read)的步骤

1. Read the Data Block.
2. Read the Row Header.
3. Check the Lock Byte to determine whether there's an ITL entry.
4. Read the ITL entry to determine the Transaction ID (Xid).
5. Read the Transaction Table using the Transaction ID. If the transaction has been committed and has a System Commit ......

Oracle维护常用SQL语句汇总

如何远程判断Oracle数据库的安装平台
select * from v$version;
查看表空间的使用情况
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_name;
SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTES*100)/A.BYTES "% USED",(C.BYTES ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号