maya
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ot_ro_get_location_tmp(double precision, double precision, integer)
Parameters
Name
Type
Mode
in_longitude
double precision
IN
in_latitude
double precision
IN
in_iddevice
integer
IN
Definition
/* v20161207 to aggregate several georeferences into the _geofences string */ DECLARE _idclient integer := 0; _geofences varchar; _location hstore; _idgeoreference integer[]; BEGIN SELECT t.idclient INTO _idclient FROM device d JOIN technicalaccount t ON t.idtechnicalaccount = d.idtechnicalaccount WHERE d.iddevice = in_iddevice; WITH q as (SELECT g FROM omni_ro_get_current_geofence(_idclient,in_longitude,in_latitude) g) SELECT array_agg(g) into _idgeoreference from q; SELECT string_agg(alias,',') INTO _geofences FROM georeference where idgeoreference IN (SELECT unnest(_idgeoreference)); _location = ot_ro_get_location(in_longitude,in_latitude) || hstore('localidad',_geofences); RETURN _location; END;