0

I'm trying to fire a sqoop import command from the shell script. It is working fine as expected.

But , if suppose the database is missing in the teradata then it need to throw the error and should not go for processing of further commands in the script.

As the syntax is correct , the sqoop import command is returning "0" and it is assuming that the sqoop import command is successful.

How to handle this type of errors in the shell script even though the database is missing in the teradata?

migrated from stackoverflow.com Jul 5 '17 at 11:22

This question came from our site for professional and enthusiast programmers.

0

This could help you to check if DB exist and/or table and if bteq exit with 1 not to proceed with loading.

bteq << eof 

select 1 from DBC.TablesV
where databasename = 'YOUR_DB';
--and TableName = 'YOUR_TABLE'; --Could add and table here.

.if activitycount = 0 then .quit 1
.quit 0

eof

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy