cast teradata

Analytics

cast teradata

can anyone help me understand a part of the script i have

it is a bteq script and it is executed in unix as a back ground process

SELECT a.orig_acct_num,
b.curr_mort_trd_cnt delq_mot_trd_cnt, -----------------------------------------------------DELINQUENT TRADE
b.optrd_bal tot_opn_tr_bal
FROM hib534_trig_stg_accounts a, pcdw.cr_rpt_efx b
WHERE a.orig_acct_num = b.acct_id
AND b.cr_rpt_yymm_val = case when cast((cast(cast('$2' as date)-$1 as date) (format 'MM')) as char(2)) = '01'
then cast((cast(cast('$2' as date)-$1 as date) (format 'YYYYMM')) as char(6)) - 89
else cast((cast(cast('$2' as date)-$1 as date) (format 'YYYYMM')) as char(6)) - 1 end;

how does this cast function ? i run this script in unix as a background process passing the parameter date everyday.

any more details i can give for u r clear understanding plz ask?

bye
1 REPLY
Teradata Employee

Re: cast teradata

Hello,

Is there any chance, that "$1" and "$2" are replaced with some values by UNIX (e.g. using shell script) before it is executed?

Regards,

Adeel