I am using a shell script to query a hive table
last_val="`hive -e "select max(id) from ${hivedatabase}.${table}"`"
echo var1="$last_val"
When the last_val = "NULL" then I want the last_val to be zero
I have tried like below but still I am getting Null
function value
{
if [ "$last_val" = "NULL" ];then
echo "0"
elif [ "$last_val" != "NULL" ];then
echo "$last_val"
fi
}
echo var2="$(value)"
I want to use this value in for incremental imports using sqoop like
select * from testing.1234abc check column id > value
How can I achieve that in shell scripting