Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Tools : $CLRTAB

$CLRTAB
Deletes (clears) the data rows from a table or table instance without reading the data rows. (C)
Invocation
CALL $CLRTAB(tablename, parm1, parm2, parm3, parm4)
 
Usage Notes
Because $CLRTAB does not take part in the TIBCO Object Service Broker two-phase commit protocol, it does not clear the intent list. It affects only the information in the specified table. Therefore, if you use $CLRTAB in a transaction that also updates data within the cleared table, you can get the following, possibly undesired, result: occurrences previously in the intent list are saved to the table at the next commit after the clearing of the table.
To prevent this, commit insertions and deletions before calling $CLRTAB.
$CLRTAB does not clear the current-occurrence buffer. It affects only the information in the specified table. For example, if you do the following:
a.
b.
c.
d.
the other fields of the inserted occurrence still contain the values you assigned. If you intend that the table be empty except for your newly assigned value, run $CLRTAB as a separate transaction followed by the update.
If called from within a transaction in BROWSE mode, $CLRTAB clears TEM, SES, EES, and SCR tables; it does not clear TDS or DB2 tables.
If the table is parameterized, the number of data parameter values supplied must equal the number of data parameters in the table definition. For example, if the table has fewer than four data parameters, type two single quotation marks ('') for each argument that is not required. If the quotation marks are not included for the excess arguments, the transaction fails with a ROUTINEFAIL exception.
To delete all the data in a parameterized table, specify a set of single quotation marks ('') for each of the arguments parm1, parm2, parm3, and parm4.
CLEARTABLE_APPL, which you can use from the CL clear table option on the standard workbench, can also be used to clear table data. This interactive tool reads and deletes each table row.
If $CLRTAB fails, you must run it again before doing another database update to prevent damage to the database. If $CLRTAB fails again, contact your database administrator or TIBCO Support immediately.

Exceptions
 
Raised if any argument fails validation, that is, for conversion errors or incorrect table type
It is also raised if, when clearing an instance of a table that has multiple data parameters, some of the data parameters for the instance are missing as arguments.
Example
The following example deletes a table instance from the table EMPLOYEE_DEPT:

 
$CLRTAB_1;
_
_ ---------------------------------------------------------------------------
_ -------------------------------------------------------------+-------------
_ CALL $CLRTAB('EMPLOYEE_DEPT','30','','',''); | 1
_ ---------------------------------------------------------------------------

 
The following example deletes all the data from all table instances of the table EMPLOYEE_DEPT:

 
$CLRTAB_2;
_
_ ---------------------------------------------------------------------------
_ -------------------------------------------------------------+-------------
_ CALL $CLRTAB('EMPLOYEE_DEPT','','','',''); | 1
_ ---------------------------------------------------------------------------

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved