Oct 18, 2007 #1 kernal Technical User Joined Feb 27, 2001 Messages 415 Location US I have a field. Example: 1064 1066 1068 Fourth digit: If 4 then "S" else if 6 then "U" else if "8" then "F" then take the second and third digits so my results would be: S06 U06 F06 Help is appreciated.
I have a field. Example: 1064 1066 1068 Fourth digit: If 4 then "S" else if 6 then "U" else if "8" then "F" then take the second and third digits so my results would be: S06 U06 F06 Help is appreciated.
Oct 18, 2007 1 #2 SantaMufasa Technical User Joined Jul 17, 2003 Messages 12,588 Location US Here are sample data, including an extra row to show what happens if there is a value that you didn't account for, above: Code: SQL> select * from kernal; VAL ---------- 1064 1066 1068 1069 Here is code to do what you asked for: Code: select decode(substr(val,4,1),'4','S','6','U','8','F','x') ||substr(val,2,2) value from kernal; VAL --- S06 U06 F06 x06 Let us know if this takes care of business for you. Mufasa (aka Dave of Sandy, Utah, USA) [I provide low-cost, remote Database Administration services: www.dasages.com] Upvote 0 Downvote
Here are sample data, including an extra row to show what happens if there is a value that you didn't account for, above: Code: SQL> select * from kernal; VAL ---------- 1064 1066 1068 1069 Here is code to do what you asked for: Code: select decode(substr(val,4,1),'4','S','6','U','8','F','x') ||substr(val,2,2) value from kernal; VAL --- S06 U06 F06 x06 Let us know if this takes care of business for you. Mufasa (aka Dave of Sandy, Utah, USA) [I provide low-cost, remote Database Administration services: www.dasages.com]
Oct 18, 2007 Thread starter #3 kernal Technical User Joined Feb 27, 2001 Messages 415 Location US Wonderful Dave. Thanks Upvote 0 Downvote