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

一沙一世界 一花一天堂 掌中握無……

网络编程技术、多媒体技术、PC应用技术

| 我爱研发网 | 中电华信 | 阿里西西 | JAVA爱好者 | 北京英才网 | 全球大学查询网 |
| 中国人的网站导航 | 中国电脑论坛 | 信息产业部 | 新浪科技 | 搜狐IT | 信息产业部电子教育与考试中心 |
| IT世界网 | 软件项目交易网 | 中国软件交易网 | 国信培训网 | 亚远景科技 | ....[更多] |