explanation of variables and query in Teradata

General
Enthusiast

explanation of variables and query in Teradata

Good afternon :

Im new at Teradata and Could anybody explain to me what this query does ?

i dont understand the sentence

Using

_spVV3 (DATE)LOCKING TABLE DWH_DATA.ACCOUNT_SUBSCRIPTION ACCESS CREATE MULTISET TABLE RCC_DATA.TMP_AboMovM_AcctSubs

USING

_spVV4 (DATE),

_spVV3 (DATE)LOCKING TABLE DWH_DATA.ACCOUNT_SUBSCRIPTION ACCESS CREATE MULTISET TABLE RCC_DATA.TMP_AboMovM_AcctSubs ,

NO BEFORE JOURNAL,

NO AFTER JOURNAL,

LOG

AS (SELECT ACS.Subscription_Id ,ACS.Account_Id FROM DWH_DATA.ACCOUNT_SUBSCRIPTION ACS

WHERE (ACS.Account_Subscription_Start_Dt <= :_spVV4 ) AND (ACS.Account_Subscription_End_Dt >= :_spVV3 )

QUALIFY (COUNT(*) OVER (PARTITION BY ACS.Subscription_Id ORDER BY ((CAST((ACS.Account_Subscription_End_Dt ) AS CHAR(10) NOT CASESPECIFIC))||' ')||(( CASE WHEN (NOT (CAST((ACS.Account_Subscription_End_Tm ) AS CHAR(8) NOT CASESPECIFIC)IS NULL )) THEN (CAST((ACS.Account_Subscription_End_Tm ) AS CHAR(8) NOT CASESPECIFIC)) ELSE ('00:00:00') END ))DESC ROWS UNBOUNDED PRECEDING ) )= 1 ) WITH DATA

UNIQUE PRIMARY INDEX ( Subscription_Id );

Id appreciate your help