FOR __campos IN SELECT JSONB_ARRAY_ELEMENTS(
(res->>'data')::JSONB
)json
FROM sima.__estudiantes_campos_obligatorios_estudiante__07(__id_estu) res
LOOP
RAISE NOTICE ' campos %' , __campos->>'desc';
FOR __sub_campos IN SELECT JSONB_ARRAY_ELEMENTS((__campos->>'datos')::jsonb)
LOOP
-- RAISE NOTICE '__sub_campos -> %', __sub_campos->>'columna';
END LOOP;
END LOOP;
-- WITH campos AS (SELECT JSONB_ARRAY_ELEMENTS(
-- (tab.json->>'datos')::JSONB
-- )json
-- FROM (SELECT JSONB_ARRAY_ELEMENTS(
-- (res->>'data')::JSONB
-- )json
-- FROM sima.__estudiantes_campos_obligatorios_estudiante__07(__id_estu) res
-- )tab )
-- SELECT ARRAY_TO_JSON(
-- ARRAY_AGG(
-- JSON_BUILD_OBJECT('desc', c.json->>'msj')
-- )
-- )
-- INTO __json_campos_oblig
-- FROM campos c
-- WHERE (c.json->>'completado')::boolean = false;
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.