The AM_TRUNCATE Purpose Function
Informix® provides built-in am_truncate purpose functions for its primary access methods that support TRUNCATE operations on columns of permanent and temporary tables. It also provides a built-in am_truncate purpose function for its secondary access method for TRUNCATE operations on B-tree indexes.
For the TRUNCATE statement to work correctly in a virtual table
interface (VTI) table requires a valid am_truncate purpose
function in the primary access method for the data type of the VTI
table. To register a new primary access method in the database, use
the CREATE PRIMARY ACCESS_METHOD statement of SQL:
CREATE PRIMARY ACCESS_METHOD vti(
AM_GETNEXT = vti_getnext
AM_TRUNCATE = vti_truncate
...);
You can also use the ALTER ACCESS_METHOD statement to add a valid am_truncate purpose
function to an existing access method that has no am_truncate purpose
function:
ALTER ACCESS_METHOD abc (ADD AM_TRUNCATE = abc_truncate);
In these examples, the vti_truncate and abc_truncate functions must be routines that support the functionality of the AM_TRUNCATE purpose option keyword, and that were previously registered in the database by the CREATE FUNCTION or CREATE ROUTINE FROM statement.