IF-THEN-ELSE-END IF - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

This form of IF runs the statements within the IF and ELSE bounds when conditional_expression evaluates to TRUE. Otherwise, the statements within the ELSE and END IF bounds run.

In the following example, only one of the specified INSERT statements runs, depending on the value for hNoAccts.

IF hNoAccts = 1 THEN
  INSERT INTO temp_table VALUES (hNoAccts, 'One customer');
ELSE
  INSERT INTO temp_table VALUES (hNoAccts, 'More than one customer');
END IF;