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. For neutrino-driven explosions the distance at which we reach 50% detection efficiency is approaching 5 kpc, and for magnetorotationally-driven explosions is up to 54 kpc. However, waveforms for extreme emission models are detectable up to 28 Mpc. For the first time, the gravitational-wave data enabled us to exclude part of the parameter spaces of two extreme emission models with confidence up to 83%, limited by coincident data coverage. Besides, using ad hoc harmonic signals windowed with Gaussian envelopes we constrained the gravitational-wave energy emitted during core-collapse at the levels of $4.27times 10^{-4},M_odot c^2$ and $1.28times 10^{-1},M_odot c^2$ for emissions at 235 Hz and 1304 Hz respectively. These constraints are two orders of magnitude more stringent than previously derived in the corresponding analysis using initial LIGO, initial Virgo and GEO 600 data.