Advertisement
ioraraj

SQL query

Sep 11th, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. usppodivximf00(usoponshximf00):/vol01/sites/provisioning/IG/46762> cat 46762.sql
  2.  
  3.  
  4. SET PAGESIZE 50000
  5. SET COLSEP ","
  6. SET LINESIZE 20000
  7. SET FEEDBACK OFF
  8. SET NEWPAGE NONE
  9. SET UNDERLINE OFF
  10.  
  11.  
  12. SPOOL /vol01/sites/provisioning/IG/46762/OBTM_Report.csv
  13.  
  14. SELECT req.request_sak, trim(req.vin) as vin_suffix,
  15. req.account_number ,
  16. req.lineitem_name as request_type,
  17. req.payment_type as payment_type,
  18. req.transaction_date as transaction_date,
  19. req.payment_date as payment_date,
  20. req.product_marketing_id as package_id,
  21. req.product_description,
  22. req.total_price as payment_amount,
  23. req.total_currency as payment_currency,
  24. req.credit_card_number ,
  25. NVL (oor.status, 'Failed') as status,
  26. req.created_timstm as run_date,
  27. NVL (des.description,
  28. NVL2 (ipa.response_reason,
  29. 'VIN: ' || ipa.vin || ' - ' || ipa.response_reason,
  30. ''
  31. )
  32. ) as error_description
  33. FROM (SELECT oor_stg.request_sak, oor_stg.vin, oor_stg.account_number,
  34. rb_stg.transaction_date, oor_stg.payment_type,
  35. oor_stg.payment_date, ool_stg.product_marketing_id, ool_stg.product_description,
  36. ool_stg.total_price, ool_stg.total_currency,
  37. SUBSTR (oor_stg.credit_card_number,
  38. -4) AS credit_card_number, oor_stg.created_timstm,
  39. ool_stg.lineitem_name
  40. FROM igappstg.obtm_order_request oor_stg,
  41. igappstg.renewal_body rb_stg,
  42. igappstg.obtm_order_lineitem ool_stg
  43. WHERE oor_stg.body_sak = rb_stg.body_sak
  44. AND oor_stg.request_sak = ool_stg.request_sak(+)
  45. AND trunc( oor_stg.created_timstm) = trunc(sysdate)
  46. ) req,
  47. igappprod.obtm_order_request oor,
  48. igappprod.ig_prm_activity ipa,
  49. igappprod.datafeed_error_skip des
  50. WHERE req.request_sak = oor.request_sak(+)
  51. AND req.vin = NVL (SUBSTR (ipa.vin(+), -8), 0)
  52. AND req.request_sak = des.sak(+)
  53. AND 'OBTM_ORDER_REQUEST' = des.table_name(+)
  54. AND 'ProcessOBTMFeedOrchestration' = ipa.bpel_name(+)
  55. AND 'Closed.HardFailure' = ipa.status(+)
  56. and req.lineitem_name in ( 'HFC','Renewal');
  57.  
  58. SPOOL OFF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement