In Oracle, functions are also called PL/SQL subroutines, which are stored in the Oracle database as database objects; the function will process the parameters passed in and return a processing result, that is, return a value. Oracle functions can be divided into two categories: system functions and user-defined functions.
The operating environment of this tutorial: Windows 7 system, Oracle 11g version, Dell G3 computer.
Definition of Oracle function
Function is stored in the oracle database as a database object, and the function is also called a PL/SQL subroutine.
The function will process the parameters passed in and return a processing result, that is, return a value. Usually used to return specific data.
Oracle functions can be divided into two categories: system functions and user-defined functions.
ORACLE function single-line function
Pseudo table: a real table that exists temporarily to facilitate data verification; table name: dual
1.Character function
Function name | Function | Example | Result |
---|---|---|---|
initcap(char) | Capitalize the first letter | initcap('nice') | Nice |
lower(char) | Convert to lower case | lower('NICE') | nice |
Convert to uppercase | upper('nice') | NICE | |
left shear | ltrim('nice','ni') | ce | |
right shear | rtrim('nice','e') | nic | |
String concatenation | concat('ni','ce') | nice | ##substr(char,pos,len) |
substr('nice',2,2) | ic | ##instr(char,substr) | |
instr('nice','c') | 3 | ##translate(char,key,value) | Translate by character mapping |
0ic1 | replace( char,old,new) | String replacement | |
nicce | 2. Numerical function |
Function name
Result | ##abs(n) | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | mod(m,n) | remainder | |||||||||||||||||||||||||||||||||||||||||||
1 | sign(n) | Get the sign | |||||||||||||||||||||||||||||||||||||||||||
-1 | ceil(n) | Round up | |||||||||||||||||||||||||||||||||||||||||||
4 | floor(n) | Round down | |||||||||||||||||||||||||||||||||||||||||||
3 | round(m,n) | Round to the specified number of decimal places | |||||||||||||||||||||||||||||||||||||||||||
3.24 | power(m,n) | m to the nth power | |||||||||||||||||||||||||||||||||||||||||||
9 | ##sqrt(n) | square root | sqrt(4) | ||||||||||||||||||||||||||||||||||||||||||
trunc(m,n) | truncated | trunc(3.233,2 ) | |||||||||||||||||||||||||||||||||||||||||||
##sin(n) | sine | sin(0) | |||||||||||||||||||||||||||||||||||||||||||
cos(n) | cosine | cos(0) | |||||||||||||||||||||||||||||||||||||||||||
3.Date function
Note:
Oracle function multi-line function
oracle function conversion function
Other functions of oracle functions
Oracle Tutorial" |
The above is the detailed content of what is oracle function. For more information, please follow other related articles on the PHP Chinese website!