信息产业培训网
[当前位置]:首页--技术专区--数据库--OracleRSS订阅按钮

oracle9i----单行函数,复习篇

http://www.miiceic.org.cn   2008-9-1 10:02:25   中程在线   浏览数:
关键字:oracle9i 单行函数

  1.两种类型的函数

  1.单行函数

  2.多行函数

  select suM(qty) from sales group by stor_id;

  select substr(au_lname,1,5) from authors;单行函数

  单行函数 包括了,

  字符函数 大小写,字符处理(lower,upper initcap) concat,substr,length instr lpad|rpad trim replace

  select lower(au_lname),upper(sdff).initcap

  c /address/au_lame

  run

  **oracl字符比较是区分大小写。

  select au_lan ||''||jkfdlf from table

  select concat(au_lnme,sdfsf) from talbe

  如果是-1是从右边取起

  instr(alu_id,'t')是否包括t

  lpad左边填充什么东西达到一个字符长度lpan(salery,10,'*'))左边填充,

  trim ('h' from 'al_id')

  结果 elloworld

  select employ_id, concat (firest_name, last_name) name, job_id,length(last_name),

  instr(last_name,'a') "Contains 'a' "?

  from employees

  where substr(job_id,4) = 'rep';

  rpad

  数字函数()

  round四舍五入 trunc省略 mod

  求余

  同上。小树点左右有关round(d1212,-1)

  正负需要重要区分。

  日期函数,

  desc table

  select sysdate form dual

  日期缺省返回。

  select (sysdate -ord_DATE)/7 FROM sale

  months_between add_months next_day last_day

  round trunc

  round (sysdate,'month')

  round(sysdate,'year')

  trunc(sysdate,'month')

  trunc(sysdate,'year')

  转换函数

  数据型的转换

  oracle -字符串到数字 字符串 到日期

  to_char to_number toData

  select to_char(ord_date,'dd-mm-yyy') from dat salte

  c/mm/month

  c/yyyy/year

  mm month mon dy day dd

  to_char(number,'format_MODEL')

  9,0$,l,. ,

  函数是可以嵌套的。

  general functions

  nvl(expr1,expr2)如果为空显示第2个

  nvl2(expr1,expr2,expr3)==

  nullif(expr1,expr2) ==填充 空值

  coalesce(expr1,expr2,...,exprn)找到不为空的例子

  select last_name, conalesce('sdf''sdfs''sf')

  condition express

  case

  decode 【need to finde 资料】

  select stor_id

  case highorlow when qty

来源:CSDN
相关连接
最新评论
*以下网友发言不代表中程在线网站的观点和看法
    我要评论

    请您注意
    1、遵守中华人民共和国的各项有关法律规定
    2、承担一切因您的行为而导致的法律责任
    3、本网留言管理人员有权删除其管辖留言内容
    4、您在本网的留言本网有权在网站内转载和引用
    5、参与本留言即表明您已经阅读并接受上述条款
    我爱研发网中电华信阿里西西JAVA爱好者北京英才网全球大学查询网
    中国人的网站导航中国电脑论坛信息产业部新浪科技搜狐IT信息产业部电子教育与考试中心
    IT世界网软件项目交易网中国软件交易网国信培训网亚远景科技....[更多]
    关于我们 | 网站地图 | 周边住宿 | 行车路线 | 联系我们 | 网站律师 | 意见反馈 | 虚位以待 | 友情链接
    中程在线(北京)科技有限公司 版权所有
    总 部:北京市海淀区青东商务楼A座西四层
    企业培训部:010-52636110 52636106 就业培训部:010-68716925 68716926
    邮 件:training@miiceic.org.cn
    京ICP备06053134号
    Copyright © 2005-2008 Miiceic.org.cn All Rights Reserved