Chances are that if you take a picture of the beach you'll have some of the ocean in the picture. Learning how to photograph the ocean is all about knowing what feel you want to convey with your photo.
Freezing the Water
One of the most common methods for photographing the ocean is to freeze the movement of the water. This method shows detail in the water and waves such as water droplets frozen in mid-air. Like most action photography, freezing the water requires a high shutter speed. While working with close up water splashes can require a shutter speed of 1/4000 of a second or faster, water splashing from waves has many speeds (due to the variety of directions of splash) and your distance from the waves will let you shoot with a more moderate shutter speed of 1/2000 of a second. If lighting conditions allow for the faster speed though, always err on the side of a quicker shutter when trying to freeze the movement of water.
To protect your camera try to avoid windy days when surf and sand are flying, and consider a protective housing on your camera such as a rain hood. You can purchase a rain hood or make your own out of a large plastic bag. This won't create a perfect line of protection for your camera but it will greatly reduce the chances of sand/water damage.
Capturing the Water's Motion
Photos of creamy streaks of water instead of frozen droplets help to convey the motion of the water in a still image. To capture the ocean's motion, use a slow shutter speed. How slow will vary based on the speed of the water but start around 1/5 of a second and make adjustments from there. To get these very slow speeds in bright light you'll need to use a low ISO, narrow aperture, and an neutral density filter (ND filter). Think of a ND filter as a pair of sunglasses for your camera. It reduces the amount of light entering the lens but is designed to not affect the color of the light. Remember you'll need a tripod, monopod, or other sturdy surface to brace your camera when shooting with low shutter speeds.
Catching the Blue
Because of the drastic light changes from foreground objects (like rocks and sand) to the brighter ocean you will often need to help your camera capture the blue of the water instead of a washed out overexposure. An easy way to do this is to use a polarizing filter. These filters help cut through the haze and tend to deepen the blue of water and sky.
Reflections on the Water
If the ocean water is smooth and waveless (most likely to happen early or late in the day) you can often capture reflections of piers, boats, and other objects. Extremely shallow water, like the fine film of water left on the beach after a wave, is also a prime area for capturing reflections. If you are using a polarizing filter to help with increasing the blue in the sky or water you'll want to remove it when photographing reflections as this filter tends to reduce the reflective effect.
Illuminating the Water
Don't limit yourself to only photographing the ocean with the sun shining on the water. Capturing waves and splashes with the sun behind the water can create stunning effects as well. Remember that with this type of shot you'll want to plan your exposure for the darker part of the water so that the sun illumination is very bright.