Yeah, you definitely have to dam the ocean at least temporarily, unless you dig out the area beneath, build everything, and then let the water in. Even if the dwarves wouldn't drown, they refuse to build anything in a tile with at least 2/7 water. Which gets annoying FAST if you're, say, breaching an aquifer. Annoying isn't unbearable though, thank god.
And yes, you can dam the ocean. Through several methods. It has to do with the fact that water flowing from offscreen is abstracted in the way that fluids technically are "destroyed" and "created" under certain conditions. Tiles at the edges of the map are deemed "water source" tiles, that infinitely spawn water at a certain rate. Since the water also usually flows offscreen at a rate similar to this, it all balances out. This is also why aquifers spawn infinite water and can absorb infinite water at the same time--the water is assumed to be flowing in from offscreen, but since the game doesn't yet track fluids (or really much of anything) offsite, it takes the route of generating/destroying. Additionally, water will only ever be generated up to a certain height, unless it is pressurized--and the word "pressure" has an extremely narrow and specific meaning within DF, so you likely won't experience too much uncontrolled flooding unless you either do it on purpose or really screw things up.
There are several ways to dam the ocean by exploiting these physics: draining the water into the caverns, draining the water into an aquifer, or pumping the water out of the ocean and onto land faster than it can flow back onscreen and walling it off. (The latter method works because DF screw pumps are CRAZY, and can pump water out of a tile near instantaneously, teleporting the entire tile's liquid contents from the intake to the output tile on a cyclical timer, set to a speed that lets you beat the flow of a water source.)