Advertisement
psi_mmobile

Untitled

Feb 26th, 2020
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.34 KB | None | 0 0
  1. else -- wbs record doesn't exist
  2. update oc_poi_load_data
  3. set existing_record = 'N'
  4. where oc_poi_load_data_id = r_ld.oc_poi_load_data_id;
  5. commit;
  6.  
  7. -- search the last active POI with name=r_ld.poi_name
  8. if r_ld.poi_short_name is not null
  9. then
  10. select max(p.poi_id)
  11. into v_poi_id
  12. from oc_poi p
  13. where p.oc_poi_category_id = v_oc_poi_category_id
  14. and p.oc_poi_status_id = 0
  15. and TRIM (UPPER(r_ld.poi_short_name)) = TRIM (UPPER(p.short_name));
  16. else
  17. select max(p.poi_id)
  18. into v_poi_id
  19. from oc_poi p
  20. where p.oc_poi_category_id = v_oc_poi_category_id
  21. and p.oc_poi_status_id = 0
  22. and TRIM (UPPER(r_ld.poi_name)) = TRIM (UPPER(p.name));
  23. end if;
  24.  
  25. if v_poi_id is not null
  26. then
  27. -- add the WBS to the POI
  28. if r_ld.ref_number is not null and (r_ld.to_date is null or r_ld.to_date > trunc (sysdate))
  29. then
  30. addWBS(v_poi_id, r_ld.wbs_name, '', r_ld.from_date, r_ld.to_date, r_ld.ref_number, sysdate, r_ld.tin);
  31. end if;
  32. commit;
  33. p_db_trc.trc(11000, 'Ref Number created v_nbr_poi_id <> 1 ' || r_ld.ref_number);
  34. commit;
  35.  
  36. -- update the POI
  37. select street, street_nr, post_code, location, country, short_name
  38. into v_street, v_street_nr, v_post_code, v_location, v_country, v_poi_short_name
  39. from oc_poi
  40. where poi_id = v_poi_id;
  41. if (v_street is null and v_post_code is null and v_location is null)
  42. then
  43. updatePoiAddr(v_poi_id,r_ld.street, r_ld.street_nr, r_ld.post_code, r_ld.location, r_ld.country);
  44. p_db_trc.trc(11000, 'POI ' || to_char(v_poi_id) || ' v_nbr_poi_id <> 1 address updated');
  45. commit;
  46. end if;
  47.  
  48. updateStatusOnWbsToDate(v_poi_id, sysdate);
  49. commit;
  50. end if;
  51.  
  52. if v_poi_id is null and (r_ld.to_date is null or r_ld.to_date > sysdate)
  53. then
  54. -- create the POI
  55. v_poi_id := createPoi(v_oc_poi_category_id, r_ld.poi_short_name, r_ld.poi_name);
  56. updatePoiAddr(v_poi_id,r_ld.street, r_ld.street_nr, r_ld.post_code, r_ld.location, r_ld.country);
  57. p_db_trc.trc(11000, 'POI created v_nbr_poi_id <> 1 ' || r_ld.poi_name);
  58. commit;
  59. update oc_poi
  60. set contact_first_name=r_ld.poi_contact_first_name, contact_last_name=r_ld.poi_contact_last_name, contact_phone=r_ld.poi_contact_phone, lm_date = sysdate
  61. where poi_id = v_poi_id;
  62.  
  63. -- add the WBS to the POI
  64. if r_ld.ref_number is not null and (r_ld.to_date is null or r_ld.to_date > trunc (sysdate))
  65. then
  66. addWBS(v_poi_id, r_ld.wbs_name, '', r_ld.from_date, r_ld.to_date, r_ld.ref_number, sysdate, r_ld.tin);
  67. end if;
  68. p_db_trc.trc(11000, 'Ref Number created v_nbr_poi_id <> 1 ' || r_ld.ref_number);
  69. commit;
  70. end if;
  71. end if; -- wbs record(s) exist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement