Saturday, 25 April 2020

在orcale資料庫,欲針對單一資料表、多個欄位,確認欄位值是否為NULL進行調整

在orcale資料庫,欲針對單一資料表、多個欄位,確認欄位值是否為NULL進行調整,SQL語法如下:



UPDATE TABLE NAME
SET
TABLE_COLUMN_NAME1 = (CASE WHEN TABLE_COLUMN_NAME1 IS NULL THEN 0 ELSE TABLE_COLUMN_NAME1 END),
TABLE_COLUMN_NAME2 = (CASE WHEN TABLE_COLUMN_NAME2 IS NULL THEN 0 ELSE TABLE_COLUMN_NAME2 END),
TABLE_COLUMN_NAME3 = (CASE WHEN TABLE_COLUMN_NAME3 IS NULL THEN 0 ELSE TABLE_COLUMN_NAME3 END)
WHERE CONDITION XXX....

No comments:

Post a Comment

IIS HTTP Error 403.18

 HTTP Error 403.18 - Forbidden The specified request cannot be processed in the application pool that is configured for this resource on the...