oracle的nvl与nvl2的函数意思

-- nvl函數

-- NVL( string1, replace_with)  功能:如果string1為NULL,則NVL函數返回replace_with的值,否則返回string1的值。

select nvl(flag,'11')flag from t_operation_log

-- nvl2函數

--  NVL2(E1, E2, E3)的功能為:如果E1為NULL,則函數返回E3,若E1不為null,則返回E2。

select nvl2(flag,'11','22')flag from t_operation_log

-- decode 函數

--decode(條件,值1,翻譯值1,值2,翻譯值2,...值n,翻譯值n,缺省值)

看满足哪个条件就返回哪个值

select flag,decode(flag,'1','成功','0','失敗') flagchina from t_operation_log

猜你喜欢

转载自blog.csdn.net/m0_64979027/article/details/129838600