Re: stored procedures perf. question
Serge,
Thanks again.
Bill
> There can be.
> Dynamic SQL is beneficial when you compose SQL statements within the
> stored procedure (beware of SQL Injection!) or you want to execute DDL
> statements not directly supported by the syntax.
> For DDL statements folks typically use EXECUTE IMMEDIATE though since
> the statement is executed only once.
> One example to use PREPARE is to perform recursive CALLs to the
> procedure you are just creating. It is the only way how a procedure can
> call itself.
> Other examples are cursors for which the exact WHERE clause is not known
> in advance.
>
> Cheers
> Serge
> --
> Serge Rielau
> DB2 Solutions Development
> IBM Toronto Lab |