Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_last_event_date(p_person_id in number, p_poi_id in number, p_param_date in date) return date as
- v_last_ge_date varchar2(50);
- begin
- select max(ge_date)
- into v_last_ge_date
- from generic_event
- where poi_id = p_poi_id
- and person_id = p_person_id
- and trunc(ge_date) = p_param_date
- and ge_type_id in (2015,2016);
- return v_last_ge_date;
- end get_last_event_date;
- function get_last_event_type(p_person_id in number, p_poi_id in number, p_param_date in date) return number as
- v_last_event_type number;
- v_last_generic_event_id number(10);
- begin
- select max(generic_event_id)
- into v_last_generic_event_id
- from generic_event
- where poi_id = p_poi_id
- and person_id = p_person_id
- and ge_type_id in (2015,2016)
- and trunc(ge_date) = p_param_date;
- --and trunc(ge_date) = get_last_event_date(p_person_id, p_poi_id);
- select ge_type_id
- into v_last_event_type
- from generic_event
- where generic_event_id = v_last_generic_event_id
- and ge_type_id in (2015,2016)
- group by ge_type_id;
- return v_last_event_type;
- end get_last_event_type;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement