「Oracle入門」NVL()で対象文字列を変換する方法

1. NVL(対象文字列,変換したい文字列)
SELECT
NVL(A.NO, ")
, NVL(A.NAME, ")
FROM
TEST_TBL1 A;

2. CASEでNULLを0に置換
SELECT
CASE
WHEN B.NUM IS NULL
THEN 0
ELSE B.NUM
END
FROM
TEST_TBL2 B;

3.Likeで文字列の一部と比較
SELECT
NVL(C.NO, ")
, C.NAME
FROM
TEST_TBL3 C WHERE LOWER(C.EMAIL) LIKE 'cft%’ ;

DataBase

Posted by arkgame