I learnt DECODE before I encountered CASE, so often my brain thinks that way first.
Therefore, I came up with an expression that uses SIGN, which I'm sure you don't see often.
SELECT SUBSTR(product_description,1,40)
||DECODE(SIGN(LENGTH(product_description)-40),1,'...') product_description
-- CASE WHEN LENGTH(product_description) > 40 THEN '...' END product_description
FROM oe.product_information;The case equivalent is commented.
This place ellipses at the end of truncated strings longer than 40 characters.
