I'm struggling a little bit about this maybe someone sees something that i don't...
select 'BEGIN dbms_stats.gather_table_stats('''SCHEMA'', ''TABLENAME_'' || to_char(trunc(sysdate, 'MM'), 'YYYY-MM')', cascade => true, no_invalidate => false); END;' from dual;
So the output should be:
BEGIN dbms_stats.gather_table_stats('SCHEMA', 'TABLENAME_2021_07'), cascade => true, no_invalidate => false); END;
Somehow I am not finding a way to escape the strings, what am I doing wrong?
Thanks in advance
TABLENAME_2021_07and then just pass it to dbms_stats.gather_table_stats as normal.