CRITICAL
Rule Definition
Each repetition of the same dynamic SQL statement incurs a soft parse, which is a small overhead compared to a static statement, but still an overhead. The overhead of dynamic SQL is small, it can be in the thousandths of a second - however, it can add up if this is inside a loop / on a method called once per object.
Remediation
Check the statement and if so, replace dynamic with static statement.
Violation Code Sample
The following procedure should be reviewed:
CREATE PROCEDURE SEARCH (IN V_DYNAMICSQL VARCHAR(2000))
BEGIN
EXECUTE IMMEDIATE V_DYNAMICSQL;
END;
Fixed Code Sample
The following procedure should be reviewed:
CREATE PROCEDURE SEARCH (IN V_DYNAMICSQL VARCHAR(2000))
BEGIN
EXECUTE IMMEDIATE V_DYNAMICSQL;
END;
Related Technologies
Technical Criterion
Efficiency - SQL and Data Handling Performance
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.