|
-
That largely worked! Thank you. It left out the situation where if there was ONLY b.major1, it left it blank. I put in an ELSE for that. I also forgot to say that I was originally using coalesce to choose between the conjugation you worked out for me and another field c.dept. I was able to add that into the code you gave me with another DECODE. here's how it turned out:
CASE
WHEN b.major2 IS NOT NULL OR b.minor IS NOT NULL OR c.dept IS NOT NULL
THEN
b.major1
|| DECODE (b.major2, NULL, '', ', ' || b.major2)
|| DECODE (b.minor, NULL, '', ', ' || b.minor)
|| DECODE (c.dept, NULL, '', ', ' || c.dept)
ELSE b.major1
END AS major
I have a question though. I don't quite understand DECODE. The first value is the expression. The 2nd through N value is a list of comparison's for the expression. Is that right? Or is it 1 compare and then one result and 1 compare and one result, in sets. And is the default value, the last value, designated by it not being part of a 2-part set?
Thank you very, very much for your assistance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|