2017-06-27 12 views
1

含めて、私は英語でデータを表示しようとすると、ロシアはnull値

SELECT temp.* 
FROM (SELECT DISTINCT CASE WHEN pd.LANGUAGE_ID = 'US' THEN COALESCE(TO_CHAR(pd.TRANSLATED_NAME), ' ') 
         END AS PRODUCT_NAME_US, 
         CASE WHEN pd.LANGUAGE_ID = 'US' THEN CONCAT(SUBSTR(pd.TRANSLATED_DESCRIPTION, 1, 30), '...') 
         END AS PRODUCT_DESC_US, 
         CASE WHEN pd.LANGUAGE_ID = 'RU' THEN COALESCE(TO_CHAR(pd.TRANSLATED_NAME), ' ') 
         END AS PRODUCT_NAME_RU, 
         CASE WHEN pd.LANGUAGE_ID = 'RU' THEN CONCAT(SUBSTR(pd.TRANSLATED_DESCRIPTION, 1, 30), '...') 
         END AS PRODUCT_DESC_RU, 
         CASE WHEN pin.WARRANTY_PERIOD = '00-00' THEN 'No Warranty' 
          WHEN EXTRACT(MONTH FROM pin.WARRANTY_PERIOD) = '00' THEN EXTRACT(YEAR FROM pin.WARRANTY_PERIOD) || ' years' 
          WHEN EXTRACT(YEAR FROM pin.WARRANTY_PERIOD) = '00' THEN EXTRACT(MONTH FROM pin.WARRANTY_PERIOD) || ' months' 
          WHEN EXTRACT(MONTH FROM pin.WARRANTY_PERIOD) <> '00' AND EXTRACT(YEAR FROM pin.WARRANTY_PERIOD) <> '00' 
          THEN EXTRACT(YEAR FROM pin.WARRANTY_PERIOD) || ' years and ' || EXTRACT(MONTH FROM pin.WARRANTY_PERIOD) ||' months' 
          ELSE 'No Warranty' 
         END AS "Warranty", inv.QUANTITY_ON_HAND AS IN_STOCK 
FROM PRODUCT_DESCRIPTIONS pd JOIN PRODUCT_INFORMATION pin 
ON pd.PRODUCT_ID = pin.PRODUCT_ID 
JOIN INVENTORIES inv 
ON inv.PRODUCT_ID = pin.PRODUCT_ID) temp 

WHERE temp.PRODUCT_NAME_US LIKE '%Monitor%' 
OR temp.PRODUCT_NAME_RU LIKE '%Монитор%' 
AND temp.IN_STOCK < 1000 
ORDER BY temp.PRODUCT_NAME_US ASC, temp."Warranty" DESC; 

しかし、結果はNULL値が含まれていません。どうすれば削除できますか?

内部クエリ内

WHERE temp.PRODUCT_NAME_US LIKE '%のモニター%' OR temp.PRODUCT_NAME_RU LIKE '%Монитор%' は

を動かして

enter image description here

+0

この回答もこの問題を解決していませんか? https://stackoverflow.com/questions/44761935/removing-null-value-from-string。 –

+0

ええ、私はそれを使うときは ORA-00979:GROUP BYの式ではない 00979. 00000 - "GROUP BYの式ではない" – Teddy

答えて

0

試してみて、外側のクエリでCOALESCEを使用