• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Loops in Teradata

 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

These core tutorials will help you to learn the Loops in Teradata. For an in-depth understanding and practical
 experience, explore Teradata Training PDF.

 

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

  1. Set Dept name=D Name1;
  2. 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

Learn more about Teradata Interview Questions in this blog post.

 

Screenshot_84

 

Note  Formatting command we can execute only in BTEQ

For Indepth knowledge on Teradata click on:

Summary
Review Date
Reviewed Item
Loops in Teradata
Author Rating
5

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Loops in Teradata"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.

    Support


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.