We present the results from a search for gravitational-wave transients associated with core-collapse supernovae observed within a source distance of approximately 20 Mpc during the first and second observing runs of Advanced LIGO and Advanced Virgo. No significant gravitational-wave candidate was detected. We report the detection efficiencies as a function of the distance for waveforms derived from multidimensional numerical simulations and phenomenological extreme emission models. The sources with neutrino-driven explosions are detectable at the distances approaching 5 kpc, and for magnetorotationally driven explosions the distances are up to 54 kpc. However, waveforms for extreme emission models are detectable up to 28 Mpc. For the first ...