Skip to main content
Version: V1.0.0

IMPORT_COLUMN_STATS

The IMPORT_COLUMN_STATS procedure is used to import column-level statistics.

Syntax

DBMS_STATS.IMPORT_COLUMN_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
colname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2,
statown VARCHAR2 DEFAULT NULL,
no_invalidate BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE);

Parameters

ParameterDescription
ownnameThe username. If the username is set to NULL, the current logged-in username will be used by default.
tabnameThe name of the table to which this column belongs.
colnameThe column name.
partnameThe name of the table partition. If the table is partitioned and partname is NULL, global and partition column statistics will be imported.
stattabThe name of the user statistics table from which statistics are to be imported.
statownThe username of the user statistics table from which statistics are to be imported.
no_invalidateSpecifies whether to invalidate the Plan Cache when collecting statistics. Set to TRUE to prevent invalidation of the Plan Cache when collecting statistics.
forceSpecifies whether to forcibly import statistics and ignore lock status. The default is FALSE. If set to TRUE, statistics will be imported even if they are locked.

Exceptions

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

Usage Notes

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

Examples

Import the statistics for the col1 column in the tbl1 table under the testUser01 user from the test_stat table.

CALL DBMS_STATS.IMPORT_COLUMN_STATS ('testUser01', 'tbl1','col1',null, stattab=>'test_stat',
statown=>'testUser01');
Query OK, 0 rows affected