The paper provides a systematic way for finding a partial differential equation that directly characterizes the optimal control, in the framework of onedimensional stochastic control problems of Mayer type, with no constraints on the controls. The results obtained are applied to continuous-time portfolio problems.