maya
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ot_ro_get_location_local(double precision, double precision, integer)
Parameters
Name
Type
Mode
in_longitude
double precision
IN
in_latitude
double precision
IN
in_iddevice
integer
IN
Definition
DECLARE _idclient integer := 0; _geofences varchar; _location hstore; _idgeoreferences 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 _idgeoreferences from q; SELECT string_agg(alias,',') INTO _geofences FROM georeference where idgeoreference in (SELECT unnest(_idgeoreferences)); _location = ot_ro_get_location(in_longitude,in_latitude) || hstore('localidad',_geofences); RETURN _location; END;