Ejemplo de actualizar si existe insert

INSERT INTO pagos.envio_comprobante (_id_documento , cant_intentos , flg_anulado , respuestas) VALUES (__id_documento , 1 , __flg_anulado , (CONCAT('[',__info,']'))::JSONB) ON CONFLICT (_id_documento) DO UPDATE SET cant_intentos = (excluded.cant_intentos+1), respuestas = (JSONB_SET(excluded.respuestas,ARRAY[JSONB_ARRAY_LENGTH(excluded.respuestas)::TEXT], __info, TRUE)), flg_anulado = __flg_anulado;

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.