EXECUTE IMMEDIATE 11gR2 and Oracle Optimizer
I would like to know the difference between the 2 following requests with respect to the optimizer 11gR2.
Could you assure me that in the 2 cases, Oracle manages bind variables ?
Which are the benefits and disadvantages of each method in 11gR2 ?
Which is the impact on the statistics 11gR2 ?
Thank you.
GD.
-- Method 1
MERGE INTO T
USING VW
ON ( T.ID = VW.ID
AND T.status = p_status -- IN PARAMETER
)
WHEN MATCHED THEN UPDATE ... ;
-- Method 2
EXECUTE IMMEDIATE ('MERGE INTO T USING VW ON ( T.ID = VW.ID AND T.status = '|| p_status || -- IN PARAMETER
') WHEN MATCHED THEN UPDATE ...)' ;