I'm trying to automate a process in Teradata, if the count is greater than 5 then do not execute the below statement

Database

I'm trying to automate a process in Teradata, if the count is greater than 5 then do not execute the below statement

--------------------------------------------------

i'm trying to automate a query that i have written , here i want to enable a QC check:

--------------------------------------------------

if count on tableX is > 5

then donot execute any statements below;

create volatile table T1 as

(

select * from TableA;

) with data

on commit preserve rows;

create volatile table t2 as

(

select * from TableB;

) with data

on commit preserve rows;

4 REPLIES
N/A

Re: I'm trying to automate a process in Teradata, if the count is greater than 5 then do not execute the below statement

Which tool do you use to submit it?

In BTEQ and (SQL Assistant 13.10+) you can use basic conditional logic:

select count (*) from tableX
having count(*) > 5;
-- no row returned when count(*) <= 5

-- no need to any additional steps
.if activitycount = 1 then .exit;

or

-- just skip some statements and then go on
.if activitycount = 1 then .goto nextStep;

create volatile table T1 as
(
select * from TableA;
) with data
on commit preserve rows;
create volatile table t2 as
(
select * from TableB;
) with data
on commit preserve rows;

.label nextStep;

Dieter

Re: I'm trying to automate a process in Teradata, if the count is greater than 5 then do not execute the below statement

Thanks Dieter, i use Teradata my sql assistant 13.11.0.05

i will try this out! Thanks a lot

Also one other thing, can i mail the result that comes out from  the count * statement

Re: I'm trying to automate a process in Teradata, if the count is greater than 5 then do not execute the below statement

Hi,

can somebody help me out,

i'm looking at a automated Qc process. i want to be able to export the Qc results via mail or directly into my local as a csv file every time my code runs. Is this feasible in Teradata. Can i write a script to achieve this in Teradata?

N/A

Re: I'm trying to automate a process in Teradata, if the count is greater than 5 then do not execute the below statement

check Teradata BTEQ in the product manual.