|
|
Archives of the TeradataForum
Message Posted: Wed, 03 Apr 2002 @ 18:02:54 GMT
Subj: | | Re: Macros and parms |
|
From: | | Karen L. Gebhard |
Here is the macro I wrote - it's keeping track of how many rows have been added etc to tables in order to keep track of growth rates and
also it lets users know when the tables have been reloaded. What we want to do is call it from different places - another macro, a batch
bteq, an mload. I can do it from bteq and mload but am having problems with calling it from another macro and passing in the counts that
are derived from sql selects.
replace macro ldwmetrics.end_stats
(databasename char(50),
tablename char(50),
jobname char(8),
insertcnt integer,
updatecnt integer,
deletecnt integer,
etcnt integer,
uvcnt integer)
as
(
/* begin end_stats macro */
UPDATE LDWMETRICS.LOAD_STATS
SET CURR_IND = 'N'
WHERE DATABASENAME = :DATABASENAME
AND TABLENAME = :TABLENAME
AND JOBNAME = :JOBNAME
AND CURR_IND = 'Y';
UPDATE LDWMETRICS.LOAD_STATS
SET END_DT = current_date (DATE, FORMAT 'YYYY-MM-DD')
, END_TIME = substr(cast(current_time as char(14)),1,8)
, END_DTS = CURRENT_TIMESTAMP(2)
, INSRT_CNT = :INSeRTCNT
, UPDT_CNT = :UPDaTeCNT
, DEL_CNT = :DELeteCNT
, ET_CNT = :ETCNT
, UV_CNT = :UVCNT
, CURR_IND = 'Y'
WHERE DATABASENAME = :DATABASENAME
AND TABLENAME = :TABLENAME
AND JOBNAME = :JOBNAME
AND CURR_IND = 'C';
);
| |