This is just a reminder in case I'll stumble upon this problem again in the future.
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.21.0.0.0
I was trying to execute something like this:
begin
DBMS_STATS.GATHER_TABLE_STATS(
ownname => ...,
tabname => ...,
cascade => TRUE,
options => 'GATHER AUTO'
);
end;
ORA-01760: illegal argument for function
As described in this excellent post-mortem analysis made by Jonathan Lewis, I believe there is a combination of factors that causes the problem, certainly I do have a materialized view referencing the table being analyzed, but may be the cascade or the specific options also play a role in this bug that seems to span 20+ years of database versions without a definitive solution.
Jonathan also mentions a workaround fixing the problem, which worked at least in my case, that is issuing:
ALTER SESSION SET QUERY_REWRITE_ENABLED = FALSE;
See message translations for ORA-01760.