Loops in Teradata

Ratings:
(4.4)
Views:1684
Banner-Img
  • Share this blog:

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:

 
About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.