All Forums UDA
Doza 2 posts Joined 10/06
25 Oct 2006
Getting bteq to just return the result

Hi,I'm new to Teradata. Extensive experience with UDB. I'm trying to convert some KSH scripts that we use for job control to hit a TD DB instead of a UDB DB. The problem I'm having is all the extra stuff that comes back with a bteq result set. With udb I can assign a variable like thisvar1="db2 -x 'select distinct field1 from table1'"That statement will return just field1 and assign the value to var1. I can't do that with bteq. I have to create an sql file that exports field1 to another file that I then cat into the variable. There has to be a more graceful way! Help!Thanks,DOZA

XTUPIE 42 posts Joined 11/05
26 Oct 2006

HiTD no can do, unless you write a program ...


j355ga 100 posts Joined 12/05
30 Oct 2006

Like the man said no can do, but here's one option you might try. Granted this is a hack but it avoids exporting. The perl ditty reads the stdout and prints just the value after the pattern you put in the output. This website clobbers the two < signs so replace the > with <.#!/usr/bin/ksh#replace > with < cuz is clobbering itbteq>>EOF | perl -ne '/this_is_the_data(.*)/ && print "$1\n"' | read MYVAR.logon whatever;select 'this_is_the_data' || trim(my_foo_column) (title '') from my_foo_table;.quitEOFecho $MYVAR


You must sign in to leave a comment.