Skip to main content
Version: V1.0.0

DELETE_COLUMN_STATS

The DELETE_COLUMN_STATS procedure is used to delete column-level statistics.

Syntax

DBMS_STATS.DELETE_COLUMN_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
colname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
cascade_parts BOOLEAN DEFAULT TRUE,
no_invalidate BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE,
col_stat_type VARCHAR2 DEFAULT 'ALL');

Parameters

ParameterDescription
ownnameThe username. If ownname is set to NULL, the current login username is used by default.
tabnameThe name of the table to which the column belongs.
colnameThe column name or alias.
partnameThe name of the partition where the statistics are stored. If the table is partitioned and partname is NULL, the statistics are stored at the global table level.
cascade_partsWhether to delete statistics at the partition level and subpartition level. The default value is TRUE.
no_invalidateWhether to clear the Plan Cache when collecting statistics. If set to TRUE, the Plan Cache will not be cleared when collecting statistics.
forceWhether to forcibly collect statistics and ignore the lock status. The default value is FALSE. If set to TRUE, statistics will be collected even if they are locked.
col_stat_typeThe type of column-level statistics to delete. The parameter can be set to the following values:
  • 'ALL': delete all column-level statistics.
  • 'HISTOGRAM': delete only histogram information at the column level.

Exceptions

Error CodeDescription
HY000
  • The table does not exist or the user does not have sufficient privileges.
  • The statistics for the object are locked.

Usage

To call this procedure, you must be the owner of the table.

Examples

Delete all statistics for the col1 column in the tbl1 table of user testUser01.

CALL DBMS_STATS.DELETE_COLUMN_STATS('testUser01', 'tbl1', 'col1',col_stat_type=>'ALL');
Query OK, 0 rows affected