Ouput integer as postive

SELECT BILLDATE,
       MONTHLYBILL_ID,
       BALANCEAMOUNT,
 
       CASE WHEN BALANCEAMOUNT < 0 THEN 'C' ELSE 'D' END AS DEBITCREDIT
  FROM MONTHLYBILL
 WHERE BILLDATE = NVL (TO_DATE ('', 'DD/MM/YYYY'), BILLDATE)
       AND MEMBER_ID = 4

In the above query, I am displaying all negative values as C and positive values as D.
But I dont want negative sign to appear in output
If I do ABS(Balanceamount) then case becomes D if integer is -ve. I want the case to remain as C but show -ve as +ve. How can I do this
GRChandrashekarAsked:
Who is Participating?
 
Pratima PharandeConnect With a Mentor Commented:
SELECT BILLDATE,
       MONTHLYBILL_ID,
       ABS(BALANCEAMOUNT) as BALANCEAMOUNT,
 
       CASE WHEN BALANCEAMOUNT < 0 THEN 'C' ELSE 'D' END AS DEBITCREDIT
  FROM MONTHLYBILL
 WHERE BILLDATE = NVL (TO_DATE ('', 'DD/MM/YYYY'), BILLDATE)
       AND MEMBER_ID = 4
0
 
jimyXCommented:
What happens when you execute this one:
SELECT BILLDATE,
       MONTHLYBILL_ID,
       ABS(BALANCEAMOUNT),
 
       CASE WHEN BALANCEAMOUNT < 0 THEN 'C' ELSE 'D' END AS DEBITCREDIT
  FROM MONTHLYBILL
 WHERE BILLDATE = NVL (TO_DATE ('', 'DD/MM/YYYY'), BILLDATE)
       AND MEMBER_ID = 4

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.