Oralce 函数
来源:互联网 发布:php soap添加header 编辑:程序博客网 时间:2024/04/24 17:24
1、substr(): 截取字符串长度
公式 : select substr(‘hello word’,start,subLength);
select substr('hello word',0,1); -- h select substr('hello word',0,1); -- h 0 和1 都表示截取位置从第一个字符开始select substr('hello word',2,4); -- elloselect substr('hello word',-1,4); -- word 负数表示截取字符从右端开始
2、instr() : 判断字符串中是否存在某个字符串
公式 instr(‘A’,’B’)
类似 Java 中的 indexof() 函数
select instr('hello word' ,'ell') from dual ; --2select instr('hello word' ,'ell') from dual where instr('hello word' ,'el1l')>0 ; -- 查不到数据
3、decode() :
公式 : decode(条件,值1,返回值1,值2,返回值2, … ,值n,返回值n )
等同
if(条件 == 值1) then return 返回值1
elseif(条件 == 值2) then return 返回值2
…
elseif (条件 == 值n) then return 返回值n
else
return (缺省值)
end if
select decode(status, 'RETURNED', '已还柜', 'PICKED', '已提柜', '其他') from DUAL;-- 如果状态为 ‘RETURNED’ 返回 '已还柜' ,如果状态为 '已还柜' 返回 'PICKED' 。依次类推
4、initcap() : 单词首字母大写,以 空格、符号 及其它非字母 限制。
select initcap('hello word') from dual ; -- Hello Wordselect initcap('hello,word') from dual ; -- Hello,Word
5、concat() : 连接字符串
公式 concat(A,B) :只能连接两个字符 ;
与 || 的区别 : 可以连接多个字符 ;
select concat('hello','word') from dual ; -- hellowordselect 'hello'||'word'||'!' as message from dual ; -- helloword!
6、replace() : 字符替换函数 ,用某个字符串替换现在的字符串
1、update test set name = replace(name,',',''); --逗号换成""
7、inner join on : 内连接
公式 : select * from A a inner join B b on a.id = b.id ;
同 : select * from A a ,B b where a.id = b.id ;
0 0
- Oralce-函数
- Oralce 函数
- oralce汇总函数备忘
- oralce函数说明
- ORALCE常用函数说明
- oralce函数大全
- Java调用oralce函数
- oralce函数大全
- oralce 常用函数
- oralce函数nullif使用
- oralce函数大全
- Oralce中的to_date()函数
- Oralce 常用函数
- oralce 函数总结
- ORALCE INSTR函数使用
- oralce函数大全
- oralce函数大全
- Oralce中的to_date()函数
- 再谈缓存穿透、缓存并发、热点缓存之最佳招式
- 仿淘宝京东拖拽商品详情页上下滚动黏滞效果
- oracle使用substr instr实现类似于java substring的功能
- gym 101196E Red Rover(枚举)
- 对视图的对角线切割DiagonalView
- Oralce 函数
- 浅谈快速排序
- UVa 1103
- 动态主题库Colorful,容易地改变App的配色方案
- E
- Activity的启动模式和onNewIntent
- 域名绑定空间
- 利用广播实现强制下线功能
- Android 从网页中跳转到本地App