Tengo la siguiente funcion que me crea un array multidimensional:
Código PHP:
CREATE OR REPLACE FUNCTION traer_valores_sop(integer, integer) RETURNS text[][] AS
$BODY$
declare
nombres text[];
valores text[];
identi integer[];
posiciones text[][];
retorno record;
i integer;
j integer;
begin
select array_agg(valor), array_agg(nombre), array_agg(ident) into valores, nombres, identi from (SELECT (select variables_servicios_id from variables_servicios where variables_servicios_id = vvs.variables_servicios_id) as ident, valor, (select nombre_dato from variables_servicios where variables_servicios_id = vvs.variables_servicios_id) as nombre from valores_variables_servicios vvs where sop_integral_id = $1 AND tipo_operacion_logistica_id = $2) as f;
i:=0;
for j IN 1..array_upper(nombres, 1) loop
i:=i+1;
posiciones[identi[i]] := array[nombres[i],valores[i]];
end loop;
return posiciones;
end;
$BODY$
LANGUAGE plpgsql VOLATILE;
$$
LANGUAGE plpgsql;
Le doy
Código PHP:
SELECT * from traer_valores_sop(180000001, 180000004)
Código PHP:
[180000075:180000145]={"{tipo_carga_dangerous_good,t}","{tipo_carga_imo,t}",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"{mode_transport_air,t}","{mode_transport_pieces,34}","{mode_transport_weight,4}","{mode_transport_dims,5}","{mode_transport_vol,3}","{mode_transport_oversize,2}",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"{otm,f}","{dta,f}","{inland,f}","{insurance,f}",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,"{insurance_percent,40}"}
Cuando intento sacar un dato asi:
Código PHP:
SELECT g[180000090][1] from traer_valores_sop(180000001, 180000004) as g;
Que será lo que estoy haciendo mal?
Gracias