An introduction to Oracle Database-- one-line function
1, one-line function
SQL >-- character function
SQL > select lower ('Hello World') turns to lowercase, upper (' Hello World') turns to uppercase, initcap ('hello world') initials uppercase
2 from dual
Turn lowercase to uppercase
Hello world HELLO WORLD Hello World
SQL >-- substr (aforme b) start with bit b in a
SQL > select substr ('Hello World',4) substring from dual
Substring
Lo World
SQL >-- substr (aheline bjorc) start with bit b in an and take bit c
SQL > select substr ('Hello World',4,3) substring from dual
Son
Lo
SQL >-- number of length characters and lengthb bytes
SQL > select length ('Hello World') character, lengthb (' Hello World') byte from dual
Character byte 11 11
SQL > ed
Written to file afiedt.buf
1 * select length ('Beijing') character, lengthb ('Beijing') byte from dual
SQL > /
Character byte 2 4
SQL >-- instr (aforme b)
SQL >-- in a, look for b
SQL > select instr ('Hello World','ll') location from dual
Location 3
SQL >-- lpad left fill rpad right fill
SQL >-- abcd-> 10 bits
SQL > select lpad ('abcd',10,'') left, rpad (' abcd',10,'') right from dual
Left and right
* * abcd abcd**
SQL >-- trim removes the specified characters before and after
SQL > select trim ('H' from 'Hello WorldH') from dual
TRIM ('H'FR
Ello World
SQL >-- replace
SQL > select replace ('Hello World','l','*') from dual
REPLACE ('HE
He*o Word
SQL > host cls
SQL >-- rounding
SQL > select round (45.926) one, round (45.926) two, round (45.926) three, round (45.926)) four, round (45.926)
2 from dual
One, two, three, four, five, 45.93, 45.9, 46, 500.
SQL >-truncation
SQL > ed