May I ask if the measure has a certain number of beats, can I still use notes in that measure that exceed the number of beats?
The whole point of having barlines is to split a piece into equal parts. If some of those parts are not equal, then they will need another time signature to accommodate them. And every bar in a piece with one time signature will have the appropriate number of beats, be it notes or rests.
Except - the first and/or last bars. Which will never have more (exceed) the quoted number, but could contain fewer. This is the anacrucis, at the beginning (the 'pick-up), which is usually only part of one bar, and the part at the end, which 'fills the gap' made at the beginning. That's usually to allow a repeat to follow say, a first verse, without a timing hiccup.
So, if you wanted the breve to be the bar-filler, the time signature would need to be 8/4, allowing a count of 8 beats in each bar (maybe not 1st and last). Or, if you wanted a note lasting those 6 beats, write in 4/4, and do as you did second, tie two semibreves across two bars.
Both ways of notation are metrically correct. The second way to notate it is the default and expected way of doing this, so unless there is a good reason against it you should stick with that. The upper example is something you’d mostly see with modern editions of old mensural scores, which did not have bar lines but the editor still decided to add bar lines for readability, such as this:
You can use something like this for example if otherwise the notations would become cluttered, but you should be careful, as this might also just get confusing.
So only use this if its meaning is clear and it is clearly beneficial for the readability of the score.
Funnily there are also cases where a brevis is used without adding a bar line, implicitly doubling the duration of the bar. Schubert does this in his canon for three male voices "Dreifach ist der Schritt der Zeit" (D43):
Note how on the cadence ("the past forever stands still") Schubert is slowing down, eventually switching the beat from the half to the whole note. It is also quite clear why Schubert decided to go for this way of writing this. If you compare these two ways of notating this, you’ll see that what Schubert is doing is less cluttered and thus somewhat easier to read:
But you will also notice that this second one is very clear on what is meant, while the first one might require a few thoughts on what this actually means. So I’d say this case does not fit the rule of a clear meaning perfectly (although well enough).
So the point is: Do what you want and what looks good, but if you go against the default, do it for a good reason, and even then only if the benefits clearly outweigh the confusion this may cause.
The simple answer is 'no'. In modern notation, a note's length cannot exceed the bar that contains it. Ancient practice (and modern facsimiles of ancient works) might differ, but that's today's rule.
And, as a corollary, bars MUST be filled, by notes or rests adding up to that bar's length. There's a Whole Bar Rest, but no Whole Bar Note, convenient though it might be when filling a bar of (say) 5/4.
We could mischievously claim that anacrusis ('pick-up') bars and any matching 'short' bar at the end of a piece break that rule I suppose!
It's HEDLEY (who later renamed to Aaron) is correct as always, but there is one exception. Pickup measures can, in theory, be any length, though they almost never go beyond 2/4. If you have some strange burning desire to use breves, and you don't happen to be on a pickup measure, simply change the time signature.