lpad 函数将左边的字符串填充一些特定的字符
select lpad('tech',3,'abcd') from dual; --将返回'tec'
select lpad('tech', 8, 'abcd') from dual; --将返回'abcdtech'
rpad 函数将右边的字符串填充一些特定的字符
select rpad('tech',3,'abcd') from dual; --将返回'tec'
select rpad('tech', 8, 'abcd') from dual; --将返回'techabcd'
where子句和having子句中的区别
1、where 不能放在group by 后面
2、having 是跟group by 连在一起用的,放在group by 后面,此时的作用相当于where
3、where 后面的条件中不能有聚集函数,比如sum(),avg()等,而having可以
length()求得是字符长度,lengthb() 求得是字节长度。
select length('年轻') from dual; 返回 2
select lengthb('年轻') from dual; 将返回 6
substr() 字符串截取
select substr('adsfas',1,3) from dual; 返回 ads
decode()函数
select decode(columnname,值1,翻译值1,值2,翻译值2,...值n,翻译值n,缺省值)
select decode( '1' , 1 , 'x is 1', 2 , 'x is 2', 'others') from dual; 将返回 x is 1
列转行函数:LISTAGG()