CREATE OR REPLACE FUNCTION sima.__estu__48_remove_brother(
__p_id_brother INTEGER,
__p_cod_familia CHARACTER VARYING,
__p_id_student INTEGER
)
RETURNS JSONB
LANGUAGE 'plpgsql'
COST 100
VOLATILE
AS $BODY$
DECLARE
-- CONSTANTS
__MSJ_ERROR CONSTANT CHARACTER VARYING DEFAULT 'Hubo un error';
-- VARIABLES
__msj_excep TEXT;
__result JSONB;
BEGIN
EXCEPTION
WHEN SQLSTATE 'SMILE' THEN
RETURN JSONB_BUILD_OBJECT('status', 1, 'msj', SQLERRM);
WHEN OTHERS THEN
GET STACKED DIAGNOSTICS __msj_excep = PG_EXCEPTION_CONTEXT;
RETURN JSONB_BUILD_OBJECT('status', 2, 'msj', __MSJ_ERROR, 'stack_error', CONCAT(SQLERRM, ' ', __msj_excep));
END
$BODY$
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.