0

I have a Bteq script file which contain multiple queries like below:

Bteq

Quer1;
Quer2_a;
Quer2_b;
Quer3;
Quer4;
.if errorcode <> 0 then .goto end_err

.label end_ok
.quit 0

.label end_err
.quit 9

FIN
exit $?

Here I want to put a conditional expression if then So if my condition is satisfied (current_date - tec_date > 1 year) then the quer2_a will be executed and the the quer2_b will be ignored then the script execute the other queries 3,4

if the condition is not satisfied the quer2_a will be ignored and the quer2_b,3,4 will be executed.

the queries 1,3 and 4 are independent of the condition.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Mado.h
  • 17
  • 4
  • You have to use ACTIVITYCOUNT here. You would have a select that will return a # of rows, that goes into the activitycount. Then you can branch based on that. – Andrew Sep 14 '21 at 15:02
  • yes, this is what i'm trying to do now, have you any idea on how i can get the value of ACTIVITYCOUNT in my logs ? – Mado.h Sep 14 '21 at 15:18
  • BTEQ has very limited logging capabilities, to say the least. Basically, you just get the commands you ran and their output, I don't think there is a way to show the value of a variable, or anything like that. – Andrew Sep 14 '21 at 18:01
  • See the BTEQ documentation at docs.teradata.com site. Note that current versions of BTEQ support multi-instruction IF / ELSEIF / ELSE / ENDIF blocks which can be nested, in addition to the old IF...THEN form. – Fred Sep 14 '21 at 18:03

0 Answers0