maya
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
omni_ro_insert_geofence_history(integer, integer[], timestamp with time zone)
Parameters
Name
Type
Mode
idunit
integer
IN
current_geofences
ARRAY
IN
seendate
timestamp with time zone
IN
Definition
DECLARE gh geofence_history; old_geofences integer[]; BEGIN gh.id := nextval('seq_geofencehistory'); gh.idunit := idunit; SELECT array_agg(idgeoreference) INTO old_geofences FROM current_geofence WHERE idunit = idunit ORDER by 1; gh.geofencein := (select array_agg(q) FROM (select unnest(current_geofences) except select unnest(old_geofences)) as q); gh.geofenceout := (select array_agg(q) FROM (select unnest(old_geofences) except select unnest(current_geofences)) as q); gh.seendate := seendate; END;