Static vs dynamic sql

前端 未结 2 1774
悲哀的现实
悲哀的现实 2020-12-14 05:18

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

2条回答
  •  半阙折子戏
    2020-12-14 05:38

    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".

提交回复
热议问题