If a person visiting Germany from Pakistan marries a Dutch Girl in Germany, can he change the visa without leaving or will he have to leave?
Secondly what will be the process for Applying for a residence permit?
Expatriates Stack Exchange is a question and answer site for people living abroad on a long-term basis. It only takes a minute to sign up.Sign up to join this community
A non-EU citizen who is the spouse of an EU citizen enjoys freedom of movement under Directive 2004/38/EC when present in an EU or Schengen country other than the country of the spouse's citizenship. So in this scenario, it is not necessary to leave Germany, and no residence permit is required, but rather a residence card issued under Article 10 of the directive. The card may be obtained from the local Ausländerbehörde.
Note that it may not be possible to marry in Germany after traveling there with a regular Schengen visa, as suggested in the comments.