日期:2014-05-16  浏览次数:20427 次

Oracle单行函数和多行函数

单行函数和多行函数示意图:

 

单行函数分为五种类型:字符函数、数值函数、日期函数、转换函数、通用函数

单行函数:

[sql] view plaincopy
  1. --大小写控制函数  
  2. select lower('Hello World') 转小写, upper('Hello World') 转大写 from dual;  
  3. --initcap: 首字母大写  
  4. select initcap('hello world') 首字符大写 from dual;  
  5.   
  6. --字符控制函数  
  7. -- concat: 字符连接函数, 等同于  ||  
  8. select concat('Hello',' World'from dual;  
  9. --substr:求母串中的某个子串  
  10. select substr('Hello World',3) from dual;  
  11. select substr('Hello World',3,4) from dual;  
  12. --length和lengthb: 字符数和字节数  
  13. select length('China') 字符数, lengthb('China') 字节数  from dual;  
  14. --instr:在母串中,查找子串的位置  
  15. select instr('Hello World','ll'from dual;