网站首页
JSP空间
动态资讯
开源项目
技术文档
资源下载
J2EE资源
客户论坛
在线支付
 
  技术文档>>数据库技术>>Oracle技术>>Oracle开发>查看文档  
  带你深入了解oracle中几个相对特殊的函数     
  文章作者:未知  文章来源:赛迪网技术社区  
  查看:123次  录入:管理员--2008-01-31  
 

1、全角转半角函数 to_single_byte

sql> select to_single_byte('oracle') from dual;

to_single_byte('oracle')
------------------------------
oracle

2、数肿?⑽模???o_char、to_date

sql> select to_char(to_date('12345','j'),'jsp') en from dual;

en
----------------------------------------
twelve thousand three hundred forty-five

不过有限制:一是长度的限制,二是不能转换带小数的

sql> select to_char(to_date('88888882345','j'),'jsp') from dual;

select to_char(to_date('88888882345','j'),'jsp') from dual

ora-01854: julian 日期必须介于 1 和 5373484 之间 

julian date指的是公元前4712年1月1日起经过的天数.

the inner to_char simply converts the number 
(which would probably be a numeric variable in practice) 
to char so some magic can happen ... 

the to_date converts the char using the j (julian day) 
format. (the julian day is the number of days since 
january 1, 4712bc, which is when sql*plus was invented), 

having established the date value, we then convert that 
date back to a julian day. because the to_char in this 
case is used in date context, we can use the j mask to 
duplicate the original value, and append the sp (spell) 
format mask. 'spell" does exactly that - it converts the 
number to words, hence the string value above. 
sp can be used in a number of situations. for example, 
if sysdate is 26-aug-98, then : 

select to_char ( sysdate, 'ddsp') from dual; -- spells 
the day as twenty-six, 
and 
select to_char ( sysdate, 'ddspth') from dual; 
--returns twenty-sixth

3、sys_guid()

oracle数据库中有一个sys_id函数,可以产生guid,但是返回的是32字节的字符串,但是如果用字符串作为主键的话效率将会不高。

 
 
上一篇: 实例讲解:sqlplus的set系统变量及其得? size= (1)    下一篇: oralce数据库定时执行存储过程的设置步骤
  相关文档
非阻塞算法思想在数据库开发中的应用 01-25
通过进行正规化的表格设计提升应用性能 (1) 06-03
解析Oracle 9i数据库异常关闭后的启动 08-05
用三个方法设置oracle数据库穿越防火墙 04-17
必须引起dba重视的oracle数据库碎片 (1) 05-12
Oracle和MySQL的一些简单命令对比 04-11
oracle数据库中使用rman建立data guard (1) 05-14
讲解v$datafile_header相关字段的使用 03-10
SQL Server与Oracle、DB2的性能比较 04-11
sql server 2008的新特性概述:集成服务 02-21
用events 跟踪解决不能创建物化试图一例 06-17
windows环境下oracle监听服务启动的问题 07-15
如何为用户提供回滚操作时间的准确评估 01-29
关于Oracle中并行处理技术原理深入分析 04-12
如何使用ref cursor处理oracle的结果集 03-26
八个学习点帮助你全面认识Oracle数据库 05-27
讲解dbms_stats的分析表与备份分析信息 08-06
菜鸟学Oracle - 用PL/SQL画直方图 05-27
通过db查询的两个数据库间scn会被同步 03-26
教你在Oracle中实现SELECT TOP N的方法 06-03
返回首页 | 关于我们 | J网章程 | JSP空间合租 | 客服中心 | 免责声明 | 常见问题 | 参观机房
本站主机空间代理至厦门市华众网络科技有限公司
《中华人民共和国增值电信业务经营许可证》
编号:闽B2-20050079
@2005-2008福建JSP技术网 版权所有 闽ICP备05000928号
厦门(总部):13616026886 福州:0591-87655121
邮箱:admin@fjjsp.com 站长QQ,点击这里给我发消息