Linux ksh script not working in crontab

I am Not sure why following script is not capturing the counts only when using crontab !! when I run it fromt he command line it is fine ! what is missing here !

#!/usr/bin/ksh

host=`uname -n`
tdate=`date`
userid='dbid/password'

totalevents=`sqlplus -s $userid << -
  set timing off
  set head off
  select count(1) from async_data_transfer where interface_id='9';

-
`
totalevents=$(echo $totalevents | tr -d '\n ')

EmailList=hello@yahoo.com\

"
echo "$totalevents"
echo "Estimated queue accumulated per SSG in Reston  =  $totalevents events. " | mailx -s "$host Reston SSG Queue Counts" $EmailList
exit 0

Here is my crontab looks like:

0,15,30,45 * * * * /home/cpac/scripts/CommandLine/chkssgQueue.ksh > /dev/null

---------- Post updated at 07:11 PM ---------- Previous update was at 06:25 PM ----------

Just figured it out. I just needed to add this line to my script:

. ${HOME}/.profile

crontab just does not have a way to know where my sqlplus is located. It worked when I added that line and it worked.

Probably because a crontab entry does not inherit or preserve the user's environment.

You need to explicitly set all of your environment such as PATH, etc. in your crontab script.