1. Aggregation function
Count (field) //number of non-empty lines max (field) //Get maximum sum (field) //Sum avg (field)/ / average min (field) / min value
2. Conversion function
To_date () string-to-time format: to_date (String, ' Yyyy-mm-dd hh24:mi:ss ') Example: To_date (' 1970-1-1 15:31:33 ' , ' Yyyy-mm-dd Hh24:mi: SS ') To_char () time-to-string format: To_char (a time, ' yyyy-mm-dd ') Example: To_char (Sbirthday, ' Yyyy-mm-dd ' ) cast () General conversion function format: CAST (data as data type (length)) Example: Cast (' 123456 ' as char (6) ) //converted from a string to a number
3. Time function
Sysdate// system Current time add_mouthe (time, value) //month plus minus last_day () //Last day of the current month
4. String functions
Length (string or field name) //Get string trim (string or field name) //Get string, remove front and back space before plus L is remove left space ltrim (), front plus R is remove right space RTrim () Replace (field name, ' ) //Find and replace (go space) replace (data, ' Find string ', ' new string ') //Replace substr (string, start position) //intercept field, default intercept to last Substr (string, start position, end position) //default intercept to specified position //If start position <0, calculate position from right start InStr (Data, ' Find string ') //Find string and return first position, not found return 0
5. Numerical functions
ABS ()/ /Get Absolute mod () //round (value)///// ///// By default, rounding round (number, number of digits)//number of digits >0 the number of digits after the decimal point =0 Rounding, number of digits <0 the decimal point before rounding ceil () upper bound value //greater than or equal to its smallest integer floor () lower value //less than equals to his smallest integer trunc () direct intercept integer// number of digits >0 The number of digits after the decimal point, the number of digits =0 rounding , the number of digits <0 the decimal point before rounding
6. Replace function
NVL (value, default) //Replace null value with default value nv12 (field, non-null replacement value, default value) //replace NULL with default value, change non-null to new value decode (field, value 1, replace value 1, value 2, replace value 2 ....) Default value) //Match the value of the field and replace the new value
Oracle database, built-in function summary