declare
    object_exists exception;
    pragma exception_init (object_exists , -00001);
begin
	execute immediate 'update ruta_secuencia r set r.kmoriginal = COALESCE((select t.cantkmreal - coalesce(t.cantkmentradasaida,0) from tramo t where t.tramo_id = r.tramo_id), 0)';
	exception when object_exists then null;
end;
