Oracle Magazine, Jan/Feb 2018
Database Developer PL SQL The values of bind variables however do not need to be concatenated And in fact theres nothing dynamic about the query in this function It can and certainly should be rewritten as follows ORACLE MAGAZINE JANUARY FEBRUARY 2018 76 FUNCTION name_ from_ id id_ in IN INTEGER RETURN VARCHAR2 AUTHID DEFINER IS l_ the_ name the_ table the_ name TYPE BEGIN SELECT the_ name INTO l_ the_ name FROM the_ table WHERE id id_ in RETURN l_ the_ name END The bottom line is that every time you come across a program that contains EXECUTE IMMEDIATE or calls to DBMS_ SQL look closely at the SQL statement being constructed Ask yourself What dont I know at the time of compilation If the answer is only the values to be assigned to a column or the values used in a Boolean expression in the WHERE clause and so on there is no need for dynamic SQL
You must have JavaScript enabled to view digital editions.