Hi Gurus,
I have a query below:
select o.loc_num AS "LOCATION", o.case_id AS "CASE_NUM",
i.division AS "DIV", substr(o.store_num,1,length(o.store_num) -1) AS "STORE", o.ctrl_dt AS "DATE"
from ord_case o, cases c, item i
where o.case_id = c.case_id
AND c.item_num = i.item_num
AND o.ctrl_dt < sysdate-3/24
AND o.loc_num LIKE '10%%'
AND o.ctrl_user_id ='I285';
This query runs fine except I would like to have an IF/ELSE loop to replace a Number with its corresponding Letter.
For example if i.division is 10 replace 10 with WO; if i.division is 4 replace with H and so on until the end.
I am new to PL/SQL and really don't even know how to create such a thing; I have looked at examples but am a little confused just where to start and how to implement.
I have a query below:
select o.loc_num AS "LOCATION", o.case_id AS "CASE_NUM",
i.division AS "DIV", substr(o.store_num,1,length(o.store_num) -1) AS "STORE", o.ctrl_dt AS "DATE"
from ord_case o, cases c, item i
where o.case_id = c.case_id
AND c.item_num = i.item_num
AND o.ctrl_dt < sysdate-3/24
AND o.loc_num LIKE '10%%'
AND o.ctrl_user_id ='I285';
This query runs fine except I would like to have an IF/ELSE loop to replace a Number with its corresponding Letter.
For example if i.division is 10 replace 10 with WO; if i.division is 4 replace with H and so on until the end.
I am new to PL/SQL and really don't even know how to create such a thing; I have looked at examples but am a little confused just where to start and how to implement.