Consider:
#!/bin/ksh
db2 connect to MKTETLPS user ....... using ........
db2 "select count(*) from etl.IDM_COLLAPSE_ORG_DEE c where c.IDM_PROCESS_STEP = 'I' and priority in ( '1','2','3','4','5') and c.update_ts < (current timestamp - 60 minutes) with ur" > l.txt
$a = /is115/idm/dsproj/scripts/l.txt
if [ $a -gt 0 ];
then
db2 "update etl.idm_collapse_org_dee
set idm_process_step = NULL where priority in (
'1','2','3','4','5')
and idm_process_step ='I'"
else
echo "All is well"
fi
I am running above the script and am receiving the below error. How can I fix it?
./CORCleanup1.sh[8]: =: not found.
./CORCleanup1.sh[10]: test: 0403-004 Specify a parameter with this command.
All is well
DB20000I The SQL command completed successfully.
DB20000I The TERMINATE command completed successfully.
db2 connect reset
db2 terminate
exit
a=$( db2 "select count(*) from tbl where cond and cond etc" )
-- though slightly less basic, command substitution is a very useful tool to learn – dave_thompson_085 Sep 02 '18 at 01:23