Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. set pages 10000
  2. select distinct SUBSTR(c.cust_income_level, 1, INSTR(c.cust_income_level, ':', 1, 1)-1) INCOME_ID
  3. (CASE INSTR(c.cust_income_level, 'Below')
  4. when 4 then 0
  5. else
  6. case instr(c.cust_income_level, 'and above')
  7. when 0 then
  8. to_number(trim(SUBSTR(c.cust_income_level, INSTR(c.cust_income_level, ':', 1, 1)+1, INSTR(c.cust_income_level, '-', 1, 1)-3)), '999.999')
  9. else
  10. to_number(trim(SUBSTR(c.cust_income_level, INSTR(c.cust_income_level, ':', 1, 1)+1, INSTR(c.cust_income_level, 'and', 1, 1)-3)), '999.999')
  11. end
  12. end)LIM_INF,
  13.  
  14. FROM customers c WHERE country_id = 'US' and c.cust_income_level IS NOT NULL
  15. ORDER BY INCOME_ID;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement