How to transmit an SQL's number of records (determined in a bteq) to the invoking shell-script?

Tools & Utilities
New Member

How to transmit an SQL's number of records (determined in a bteq) to the invoking shell-script?

I tried to use activitycount via .quit ACTIVITYCO

I get the right answer 5439 on standard output: 

 

.quit ACTIVITYCO
*** You are now logged off from the DBC.
*** Exiting BTEQ...
*** RC (return code) = 5439

but how canI let know the invoking shellscript the activitycount?

1 REPLY
Teradata Employee

Re: How to transmit an SQL's number of records (determined in a bteq) to the invoking shell-script?

Since only the low-order byte will get passed to the shell script, Return Code / Exit code isn't a good method.

 

You can parse the BTEQ stdout to obtain the activity count. Or write a Notify Exit, have BTEQ pass the value to the exit, and have the exit write it to a file which the shell reads.

Or use something other than BTEQ, e.g. there are Teradata drivers available for use with Perl and Python specificially, as well as standard ODBC, JDBC, and .NET drivers.