[SQL] record what problems and solutions encountered today
Demand : Some fields require a data check out the escape and then stitching.
Solution :
1, two field splicing methods:
CONCAT(A.NAME, B.CODE) AS CON;
If there is a fixed value, the fixed value plus quotes:
CONCAT(A.NAME, '次'));
2, conditional escape
CASE A.RUN_STATUS
WHEN 'RUNNING'
THEN '运行'
WHEN 'NOT_RUN'
THEN '非运行'
ELSE A.RUN_STATUS
END
AS 巡视说明
3, the escape of air, for example: if it is assigned a null value
NVL(A.CYCLE_NUMBER, 1);