#!/bin/bash
a=`sqlplus -s /
if [ "$a" = "$b" ]; # Comparing if the dates are same. This was just the logic I had required in my script. Could be different for you.
then flag=0;
else flag=1;
fi;
if [ "$flag" = 0 ];
then echo "Dates are same. Body of the mail"|mail -s "Subject of the mail" yourname@yoursite.com;
else
echo "Dates are different, Body of the mail"|mail -s "Subject of the mail" yourname@yoursite.com;
fi;
##################END######################
test.sql can be obtained as following. Remember, test.sql could have been made inline with the redirection operator "<<".
SET echo off;
SET pagesize 0;
SET heading off;
select MY_DATE
from MY_TABLE;
No comments:
Post a Comment