Using Decode and substr together:-
Decode wil replace the IF-THEN-ELSE
e.g
SELECT full_name,
decode(Current_employee_flag, 'Y', 'EMP',
'N', 'Not Emp')result
FROM per_all_people_f;
Substr will filter values to the length you specify
Eg
SELECT SUBSTR('Take the first four characters', 1, 4) FIRST_FOUR
FROM dual;
FROM dual;
To use both:
SUM(DECODE(Substr(piv.uom, 1, 1), 'M', prrv.result_value, NULL)) amount,
Will result value will grouped for numeric values.
No comments:
Post a Comment
Thanks for your comments submitted.,will review and Post soon! by admin.