G-6010: Always use a character variable to execute dynamic SQL.
Major
Maintainability, Testability
Reason
Having the executed statement in a variable makes it easier to debug your code (e.g. by logging the statement that failed).
Example (bad)
DECLARE
l_next_val employees.employee_id%TYPE;
BEGIN
EXECUTE IMMEDIATE 'select employees_seq.nextval from dual' INTO l_next_val;
END;
/
Example (good)
DECLARE
l_next_val employees.employee_id%TYPE;
co_sql CONSTANT types_up.big_string_type :=
'select employees_seq.nextval from dual';
BEGIN
EXECUTE IMMEDIATE co_sql INTO l_next_val;
END;
/