In my database at several places developers have used dynamic sql instead of static. And they are saying reason for this is to improve the performance. Can someone tell me
Unfortunately, this does vary on a case-by-case basis.
For your given examples, there is probably no measurable difference. But for a more complicated example, you'd probably want to test your own code.
The link @DumbCoder gave in the comments has some excellent rules of thumb which also apply to Oracle for the most part. You can use something like this to assist you in deciding, but there is no simple rule like "dynamic is faster than static".