Oracle Magazine, Jan/Feb 2018
Database Developer PL SQL SKIN DEEP DYNAMIC SQL Sometimes a programs requirements or implementation seem at first glance to be an obvious candidate for dynamic SQL Only with further analysis driven by that key rule to use dynamic SQL only when necessary do you realize that a static SQL implementation is possible and therefore preferable Suppose you came across this function in your applications source code ORACLE MAGAZINE JANUARY FEBRUARY 2018 79 FUNCTION name_ from_ id table_ in IN VARCHAR2 id_ in IN INTEGER RETURN VARCHAR2 AUTHID DEFINER IS l_ the_ name VARCHAR2 32767 BEGIN EXECUTE IMMEDIATE select the_ name from table_ in where id id_ in INTO l_ the_ name RETURN l_ the_ name END It looks like the developer had no choice right EXECUTE IMMEDIATE is required because the name of the table wasnt known at the time of compilation a classic requirement for a dynamic SQL implementation
You must have JavaScript enabled to view digital editions.