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

trunc()函数的学习 (oracle)

trunc()函数有两种用法 1:后面跟日期  2: 后面跟数字
A: SELECT a.times,to_date(a.times,'yyyymmdd'),trunc(to_date(a.times,'yyyymmdd'),'month') from dmf_loan_limit a
显示的结果为:
1 20080131     2008-1-31    2008-1-1
2 20080131     2008-1-31    2008-1-1
3 20080131     2008-1-31    2008-1-1
4 20080131     2008-1-31    2008-1-1
5 20080229     2008-2-29    2008-2-1
6 20080229     2008-2-29    2008-2-1
7 20080229     2008-2-29    2008-2-1
8 20080229     2008-2-29    2008-2-1
9 20080331     2008-3-31    2008-3-1
10 20080331    2008-3-31    2008-3-1
11 20080331    2008-3-31    2008-3-1
12 20080331    2008-3-31    2008-3-1
13 20080430    2008-4-30    2008-4-1
解释:trunc(to_date(a.times,'yyyymmdd'),'month')  将a.times 转换成 yyyymmdd的日期形式,并且返回a.time所在月的第一天。通过这个公式就可以求出这天到这月的第一天相差具体的天数。
B: 
SELECT a.times,to_date(a.times,'yyyymmdd'),trunc(to_date(a.times,'yyyymmdd'),'year') from dmf_loan_limit a
1 20080131      2008-1-31      2008-1-1
2 20080131      2008-1-31      2008-1-1
3 20080131      2008-1-31      2008-1-1
4 20080131      2008-1-31      2008-1-1
5 20080229     


相关文档:

linux oracle 安装

linux下oracle安装:
Oracle公司宣称在Linux下安装Oracle9i数据库至少要有512MB的内存和至少1GB或者两倍     
内存大小的交换空间,对于系统内存大于2GB的服务器,交换空间可以介于2GB—4GB之间。     
如果是为了在一台仅有256M内存的普通PC机上试用Oracle9 ......

oracle批量(batch)操作的使用

    /**
     * 更新记录,原子操作,不会commit
     * @param sql_id
     * @param condition
     * @return
     * @throws SQLException
     */
  &nbs ......

oracle数据字典小结


下面按类别列出一些ORACLE用户常用数据字典的查询使用方法。
   
    一、用户
    查看当前用户的缺省表空间
    SQL>select username,default_tablespace from user_users;
    查看当前用户的角色
    SQL ......

只读权限oracle用户

-- Create the user
create user SMCQUERY
  identified by SMCQUERY;
-- Grant/Revoke role privileges
grant connect to SMCQUERY;
-- Grant/Revoke system privileges
grant select any table to SMCQUERY;
grant debug any procedure to SMCQUERY;
grant debug connect session to SMCQUERY;
grant cr ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号