Teradata Loops

If<Condition>Then<Statement1>;

Else<Statment2>;

End If  

Description

If the condition is successes if executes statement1, other wise executes statement2  

While loop

While(<Condition>)Do

<SQL Statements>

End while;  

Description

If repeats in till condition fails   

Looping[For Loop]

Loop Label: Label- Name

<Statements>

End loop Label- Name  

Description

Till the condition False the loop will be Repeated

Inclined to build a profession as Teradata Developer? Then here is the blog post on, explore Teradata Training

Declaring variable

Syntax -  Declare<Variable name><Data type>;

Ex - Declare Dept name Varchar(30);

Assigning values to variables;  

Syntax  - Set < Varchar >=<value>or<variable>or<columnname>

Ex:

Set Dept name=D Name1;

Set Dept name= IT

Format command

9   2 Digit

Z   2 Zero Suppressed Digit

$2Under score etc

2  Formatting string

X 2 Single character

B 2 BLANK

Formatting Dates

DD 2 DAY

MMMM 2 Full month

YY 2 Year

YYYY 2 Full year

B 2 Blank etc…

85000 2 $9999 2 $85000

Teradata Interview Questions

  Formatting Dates  

Note:  

Formatting command we can execute only in BTEQ.

For In-depth knowledge on Teradata click on: