Advertisement
psi_mmobile

Untitled

Sep 11th, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. function get_last_event_date(p_person_id in number, p_poi_id in number, p_param_date in date) return date as
  2. v_last_ge_date varchar2(50);
  3. begin
  4. select max(ge_date)
  5. into v_last_ge_date
  6. from generic_event
  7. where poi_id = p_poi_id
  8. and person_id = p_person_id
  9. and trunc(ge_date) = p_param_date
  10. and ge_type_id in (2015,2016);
  11.  
  12. return v_last_ge_date;
  13.  
  14. end get_last_event_date;
  15.  
  16. function get_last_event_type(p_person_id in number, p_poi_id in number, p_param_date in date) return number as
  17. v_last_event_type number;
  18. v_last_generic_event_id number(10);
  19. begin
  20. select max(generic_event_id)
  21. into v_last_generic_event_id
  22. from generic_event
  23. where poi_id = p_poi_id
  24. and person_id = p_person_id
  25. and ge_type_id in (2015,2016)
  26. and trunc(ge_date) = p_param_date;
  27. --and trunc(ge_date) = get_last_event_date(p_person_id, p_poi_id);
  28.  
  29. select ge_type_id
  30. into v_last_event_type
  31. from generic_event
  32. where generic_event_id = v_last_generic_event_id
  33. and ge_type_id in (2015,2016)
  34. group by ge_type_id;
  35.  
  36.  
  37. return v_last_event_type;
  38.  
  39. end get_last_event_type;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement