15.10 - AutomateSingleStat - Teradata Database

Teradata Database Application Programming Reference

prodname
Teradata Database
vrm_release
15.10
category
Programming Reference
featnum
B035-1090-151K

Copies the definition of a single specified statistic from the dictionary to the TDSTATS database.

REPLACE PROCEDURE TDSTATS.AutomateSingleStat(
 IN DatabaseName VARCHAR(128) CHARACTER SET UNICODE,
 IN TableName    VARCHAR(128) CHARACTER SET UNICODE,
 IN StatsId      INTEGER,
 IN MarkApproved CHAR(1) CHARACTER SET LATIN,
 OUT AutomateId  BIGINT,
 OUT NumCopied   INTEGER)
                  .
                  .
                  .
;
 

Parameter

Description

DatabaseName

Name of the database in which the statistic exists.

Note: This input parameter cannot be NULL.

This input parameter may contain wildcard characters (%, _). For more information about wildcard characters, see “Usage Notes.”

TableName

Name of the table on which statistics exists.

Note: This input parameter cannot be NULL.

This input parameter may contain wildcard characters (%, _). For more information about wildcard characters, see “Usage Notes.”

StatsID

Dictionary ID for the statistic as stored in the DBC.StatsTbl.StatsId column.

Note: This input parameter cannot be NULL.

MarkedApproved

Possible values:

  • Y or NULL. If you specify Y or NULL, the copied statistic is marked approved and is included in subsequent calls to PrepCollect and RunCollect. The default value is Y.
  • N. If you specify N, the copied statistic is marked unapproved. To approve the statistic, you can call ApproveStat.
  • Wildcard Characters

    The following table describes the wildcard characters that the names of some databases, tables, and objects contain.

     

    Character

    Description

    % (PERCENT SIGN)

    Represents any string of zero or more arbitrary characters. Any string of characters is acceptable as a replacement for the percent.

    _ (LOW LINE)

    Represents exactly one arbitrary character. Any single character is acceptable in the position in which the underscore character appears.

    For more information on how to use these wildcard characters, see the SQL LIKE clause in SQL Functions, Operators, Expressions, and Predicates.

     

    Parameter

    Description

    AutomateId

    System supplied ID for the history results from this automation.

    NumCopied

    Possible values:

  • 0 means the copy operation failed.
  • 1 means the copy operation succeeded.
  • The following example shows how to automate the statistic defined on Personnel.Employee database whose dictionary assigned DBC.StatsTbl.StatsId column value is 1.

    CALL TDSTATS.AutomateSingleStat ('Personnel', 'Employee', 1, 'Y', AutomateId, NumCopied);
     
    *** Procedure has been executed. 
     *** Total elapsed time was 10 seconds.
     
     AutomateId    NumCopied
    -------------  -------------
          2         1