getting an error count from bteq and unix ksh

Tools
Enthusiast

getting an error count from bteq and unix ksh

I have a big ksh script where I have created a bteq function thats looks like this:

td_query () { bteq << EOF |grep '^>' |sed -e "s/^>//" 
$(cat $HOME/.tdlogon)
DATABASE mycontainer;
.set width 1000;
.set titledashes off;
$1
.LOGOFF;
.QUIT;
.EXIT
EOF
}

I pass query into the function like this:

td_query "sel * from table ;"

now, if there is a query error, how can I capture that error to an error count variable? is that possible?

2 REPLIES
Enthusiast

Re: getting an error count from bteq and unix ksh

anyone done anything similar?

Enthusiast

Re: getting an error count from bteq and unix ksh

.QUIT ERRORCODE