Thank you that worked. But now I want to have the distinct values for the column which is satisfied in the case statement and also want to get the condition satisfied for the variable &divisionbox but oracle does not accept Boolean. So how can I put the Boolean condition?
Select CASE WHEN '®IONDIVISION' is not null AND ('&DIVISIONID' NOT IN ( 'Non-Technical', 'Technical')) AND '&DIVISIONBOX' = FALSE THEN SEGMENTNAME
ELSE REGIONNAME END as Segment,
sUM(spreadamt) AS SPREAD, FROM table a
GROUP BY CASE WHEN '®IONDIVISION' is not null AND('&DIVISIONID' NOT IN ( 'Non-Technical', 'Technical')) THEN SEGMENTNAME
ELSE REGIONNAME END