The invention discloses a hydroscillator which is used in petroleum drilling and other fields and has a cuttings discharging function. According to the technical scheme, an upper connector, a stator casing, a universal shaft casing, a bearing supporting sub and a lower connector are sequentially in threaded connection; a power assembly comprises the upper connector, a rotor compressing cap, a screw rotor, a rubber stator and the stator casing; the screw rotor, a universal shaft and a transmission shaft are sequentially in threaded connection; a valve assembly comprises a flow passing transmission shaft, a cam system, a spray nozzle, a spring system and the lower connector, the flow passing transmission shaft and a cam bushing are in threaded connection, a cam is fixed on the cam bushing through screws, and a valve element is matched with the lower connector through a key groove; the cam system converts rotation motion of a screw motor into axial motion of the valve element, and opening and closing of a valve are realized. With the adoption of the hydroscillator, friction resistance between a drilling tool at the lower part of a horizontal well or a large-displacement well and the well wall can be reduced effectively, the cuttings bringing capacity of a drilling fluid can be improved, the drilling efficiency is improved, and downhole accidents such as sticking can be avoided.