Looping in Teradata sql

Database

Looping in Teradata sql

Hi,

I am a beginner for Teradata. I am trying to convert following SAS code in sql.

DO i=1 to 20 BY 1

IF (x>i/y) THEN DO

Z

It seems there are no loops available in sql. Any help would be appreciated.

Thanks.

2 REPLIES
N/A

Re: Looping in Teradata sql

You need to create a Stored Procedure to be able to use loops, of course most DBA's don't like end users to create SPs.

What are you trying to achieve? Maybe it's possible in plan SQL.

Dieter

Re: Looping in Teradata sql

Dieter,

I was using this snippet of code for the purpose of bucketing. There are 20 different buckets and I have to perform 20 different actions for them based on some conditions.

Thanks