The Oracle nvl () and nvl2 () functions introduce a function in the NVL function Oracle/PLSQL. Format: www.2cto.com NVL (string1, replace_with) function: If string1 is NULL, The NVL function returns the value of replace_with; otherwise, the value of string1. Note: string1 and replace_with must be of the same data type unless the TO_CHAR function is displayed. For example: NVL (TO_CHAR (numeric_column), 'some string'). numeric_column indicates a numerical value. For example, nvl (yanlei777, 0)> 0 NVL (yanlei777, 0) means that if yanlei777 is NULL, the value 0 is used to obtain the total value of a field through the query, if this value is null, a default value, such as select nvl (sum (t. dwxhl), 1) from tb_jhde t indicates that if sum (t. dwxhl) = NULL returns 1 another useful method related to declare I integer select nvl (sum (t. dwxhl), 1) into I from tb_jhde t where zydm =-1 so that the obtained total value can be stored in variable I, if the queried value is null, set its value to the default value of 1 oracle: www.2cto.com select nvl (rulescore, 0) from zwjc_graderule where ruleco De = 'fwtd '; if the record does not contain data with rulecode = 'fwtd. no data is found. select nvl (rulescore, 0) into rule_score from zwjc_graderule where rulecode = 'fwtd '; select nvl (sum (rulescore), 0) from zwjc_graderule where rulecode = 'fwtd '; if the record does not contain rulecode = 'fwtd' data. you can also obtain data with a column name of nvl (rulescore, 0) and a value of 0. select nvl (sum (rulescore), 0) into rule_score from zwjc_graderule where rulecode = 'fwtd' For NVL2 functions. NVL2 (E1, E2, E3) functions: If E1 is NULL, the function returns E3. If E1 is not null, the function returns E2.