Measurements can be used in an optimization framework to compensate the effects of uncertainty in the form of model mismatch or process disturbances. The main bottleneck when trying to reformulate a dynamic optimization problem as a control problem is the definition of the inputs, of the outputs and of the corresponding setpoints. Among the various options for input update, a promising approach consists of directly enforcing the Necessary Conditions of Optimality (NCO) (that include two parts, the active constraints and the sensitivities), by manipulating the appropriate parameters of the input profile. In this talk, after a general presentation of the methodology, it will be shown that the variations of the NCO due to parametric uncertainty can be used to: (i) quantify the negative impact on uncertainty on the NCO, (ii) separate input parameters to properly control the two parts of the NCO, and (iii) design appropriate update laws for the inputs. To implement these control laws, two control algorithms will be proposed, for which global convergence can be established for a class of nonlinear systems. Finally, the theoretical concepts will be illustrated through the run-to-run optimization of an industrial batch inverse-emulsion copolymerization reactor.