I have two sql statements SQL 1 & SQL 2. Further, I want to run them as per below logic,
SELECT *
FROM MY_TABLE
WHERE COL1 > 0;
If ACTIVITY_COUNT = 0 THEN RUN SQL 1 ----- if records are present then run sql 1
ELSE
RUN SQL 2 ----- if records are not present the run sql 2
Could you please suggest a TERADATA SQL CODE ?
Thanks in Advance!
SQL Assistant supports old BTEQ syntax:
SELECT *
FROM MY_TABLE
WHERE COL1 > 0;
.IF ACTIVITYCOUNT = 0 THEN .GOTO l2; -- no result, skip SQL 1
SQL 1 ----- if records are present then run sql 1
.EXIT; -- don't run SQL2
.LABEL l2;
SQL 2 ----- if records are not present the run sql 2