Select Initcap (' Guodongdong ') from dual; /returns a string and capitalizes the first letter of the string;
Select Initcap (ename) from Scott.emp; /start all uppercase for ename in the Scott.emp table.
Select Lower (ename) from scott.emp;/all lowercase in ename name for scott.emp table.
SELECT * from Scott.emp where lower (ename) = ' Scott '; /In case Scott is case-sensitive.
Select Upper (ename) from scott.emp;/all uppercase for Ename name in scott.emp table
Select Length (ename) from Scott.emp; /Query The number of words that the ename name in the Scott.emp table occupies.
Select Ename,substr (Ename,length (ename)-2) from Scott.emp/query scott.emp table ename name The last three English names.
or select Ename,substr (ename,-3) from Scott.emp;
Select Concat (' Guo ', ' Dongdong ') from dual; /concat can only connect two strings, no | | Powerful.
Select Concat (ename,sal) from Scott.emp; /Make a connection for the name in the Scott.emp table.
Select substr (' Guodongdong ', 1,5) from dual;/query Guodongdong, 1-5 words from the left side are listed.
Select SUBSRT (' Guodongdong ', -1,5) from dual; /start from the right.
Select SUBSRT (' Guodongdong ', -1) from dual; /intercept at the end;
Select Lpad (' Guodongdong ', ' * ') from dual; /display guodongdong,15 means 15 for, not enough 15 for the front fill *.
Select Rpad (' Guodongdong ', ' * ') from dual; /display guodongdong,15 means 15 for, not enough 15 for the rear fill *.
Select Lpad (Ename,length (ename) +30, ' * ') from scott.emp;
Select Lpad (Ename,length (ename) +30, ' * ') from scott.emp;
Select Rpad (Lpad (Ename,length (ename) +30, ' * '), Length (Lpad (Ename,length (ename) +30, ' * ')) +30, ' * ') from scott.emp;
Select replace (' Guodongdong ', ' d ', ' J ') from dual; /modify guodongdong,d words are all replaced by J, then Guojongjong
Select Trim (' K ' from ' GKGGUODONKKGDONGGG ') from dual; /As long as the GKGGUODONKKGDONGGG removes the space before and after the specified character.
LTrim
RTrim
Three main functions: Round,trunc,mod
1:select
Round (78915.67823823), 78916, the content after the decimal point is rounded directly
Round (78915.67823823,2), 78915.68, reserved two decimal places
Round (78915.67823823,-2), 78900, canceled less than 5 of the data.
Round (78985.67823823,-2), 79000, if more than 5 carry
Round (-15.65);-16
from dual;
2: Intercept decimals, all decimals are not rounded
SELECT
Trunc (78915.67823823), 78916, the content after the decimal point is rounded directly
Trunc (78915.67823823,2), 78915.68, reserved two decimal places
Trunc (78915.67823823,-2), 78900, canceled less than 5 of the data.
Trunc (78985.67823823,-2), 79000, if more than 5 carry
Trunc (-15.65);-16
from dual;
3: Modulo (seeking remainder)
Select mod (10,3) from dual; 1
Oracle Common String Functions