What is the difference in both usage and memory ?
Custom SQL and Dynamic SQL we have to write the queries explicitly.The main difference between Custom SQL and Dynamic SQL is, in Custom SQL we can give the input values at design time. In Dynamic SQL we can give the input values at run time.
By using custom SQL, one can execute any static SQL statements but by using dynamic we can able to execute only input field which query you set.
In CustomSQL, you can pass inputs to your SQL query at runtime. With DynamicSQL, you can pass your entire SQL statement, or part of your SQL statement (like the where clause) can be passed at runtime; along with inputs to it. In simple words, with dynamicSQL you can dynamically build your SQL statement at runtime.
Customizing The SQL QUERY is fixed with input variable that are passed to the custom adapter service. But in runtime you use dynamic SQL if SQL query changes during the runtime in this cases you prepare the sql query and pass it to dynamic adapter service in the runtime.