Executing teradata procedures in unix shell scripts

UDA
Enthusiast

Executing teradata procedures in unix shell scripts

sqlplus -s /nolog @/rsl/app/upendra/login.sql << EOF
set serveroutput on
set timing on
exec CAT_CHCONFIG_APP('M','1');
EOF

CAT_CHCONFIG_APP is an oracle procedure.
Is there any way to run teradata procedures in shell scripts.

3 REPLIES
Enthusiast

Re: Executing teradata procedures in unix shell scripts

bteq << EOF
.logon $SERV/$USERNAME,$PASSWORD
call 'procedure name()'
.quit
EOF

Re: Executing teradata procedures in unix shell scripts

is there a way by which I can capture the SQL errors from the Stored Procedure in the Unix script that calls the Stored Procedure ??
Enthusiast

Re: Executing teradata procedures in unix shell scripts

You can configure your BTEQ script to exit whenever an error level occurs that is above a given threshold. the .SET MAXERROR statement achieves this. Alternatively, you can check the error level after each call to a stored procedure and use conditional logic to either continue or exit. But all that you'll be able to pass back to the shell script is (I believe) a single byte standard return code value. So no SQL error codes.

If you need to have the SQL error codes available in UNIX, you can export the error codes to a log file or store them in a database log table and then extract the contents of said table.

Hope this helps.