ORA-54032 Hidden Virtual Column Mystery

This error happend when it tries to modify a column definition.

ALTER TABLE TABLE RENAME COLUMN COLUMN_1 TO COLUMN_2
Error report -
ORA-54032: column to be renamed is used in a virtual column expression
54032. 0000 -  "column to be renamed is used in a virtual column expression"
*Cause:    Attempted to rename a column that was used in a virtual column
           expression.
*Action:   Drop the virtual column first or change the virtual column
           expression to eliminate dependency on the column to be renamed.

To solve this problem just drop and recreate the extended stats.

select column_name, data_default, hidden_column 
from   user_tab_cols
where  table_name = 'TABLE';

COLUMN_NAME                    DATA_DEFAULT                   HID
-----------                 ------------                   ---
SYS_STSJRWMRSJ9R67FKTI__#YY73V SYS_OP_COMBINED_HASH("X","Y"   YES
Z                                                             NO
Y                                                             NO
X                                                             NO

To solve this problem just drop and recreate the extended stats

exec dbms_stats.drop_extended_stats(username, 'table', '(x, y)');

alter table TABLE rename column COLUMN_1 TO COLUMN_2;

select dbms_stats.create_extended_stats(username, 'tabble', '(x, y)')
from   dual;

DBMS_STATS.CREATE_EXTENDED_STATS(USER,'TAB','(X,Y)')                           
--------------------------------------------------------------------
SYS_STSJRWMRSJ9R67FKTI__#YY73V

Info obtained from Chris Saxon – Developer Advocate on the following link ORA-54033 and the Hidden Virtual Column Mystery

Deja una respuesta