Error in WHILE and IF Loop inside a teradata Stored Procedure

Database
N/A

Error in WHILE and IF Loop inside a teradata Stored Procedure

Hello folks,

 

Below is a block of code that I am using in my Teradata stored procedure. The variableSOAD_START_DATE,LOAD_END_DATE, CURRENT_START_DATE,CURRENT_END_DATE  are defined as DATE Variables.   

 

WHILE (LOAD_START_DATE < LOAD_END_DATE) DO
        IF (DATE LOAD_END_DATE -  DATE LOAD_START_DATE) > 90
        THEN
            SET CURRENT_START_DATE = :LOAD_START_DATE;
            SET CURRENT_END_DATE = :LOAD_START_DATE+90;
        ELSE 
            SET CURRENT_START_DATE=:LOAD_START_DATE;
            SET CURRENT_END_DATE=:LOAD_END_DATE;
        END IF;
END WHILE;

Errors:

Capture.PNG

 

 Can you please help me understand what is wrong in the code?  

 

Regards,

SB 

1 REPLY
Teradata Employee

Re: Error in WHILE and IF Loop inside a teradata Stored Procedure

You should not have the keyword / built-in function DATE in your IF condition - just the variable names.