mysql中
IFNULL(a,b); 如果a为空,就显示b的值
oracle中
nvl(x,value)将一个NULL转换为另外一个值,如果x为NULL,则返回value,否则返回x值本身
insert into student values(7,'猪猪',default,NULL);
select nvl(address,'北京市') from student;
nvl2(x,value1,value2),如果x不为NULL,返回value1,否则,返回value2
select nvl2(address,'有地址','无地址') from student;
举例:这两块代码效果是一样的
SELECT * FROM (
SELECT A.*, ROWNUM RN FROM (
select p.RESOURCE_ID,NVL(p.PZRQ,'暂无') FROM
EP_BASE_KY_PROJECT p
ORDER BY p.RESOURCE_ID) A
WHERE ROWNUM <= 10
) WHERE RN >= 0
SELECT * FROM (
SELECT A.*, ROWNUM RN FROM (
select p.RESOURCE_ID,NVL2(p.PZRQ,p.PZRQ,'暂无') FROM
EP_BASE_KY_PROJECT p
ORDER BY p.RESOURCE_ID) A
WHERE ROWNUM <= 10
) WHERE RN >= 0