The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-05-2006
dstinsman dstinsman is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 23
MAILX Body containing SQL results

I have a KSH script that runs a SQL script, then sends an email to me indicating that it's completed. I would like to modify it so that the body of the email will contain a count of the number of records Added, Changed, Deleted as a result of the SQL script.

Here's what I was trying, but it's not working...what am I doing wrong?

Code:
MESG_GOOD="Completed Successfully"

cntADD=sqlplus -s user/pwd select count(*) from tbl where...;
cntCHA=sqlplus -s user/pwd select count(*) from tbl where...;
cntDEL=sqlplus -s user/pwd select count(*) from tbl where...;

content="Adds: " && cntADD && "Changes: " && cntCHA && "Deletes: " &&cntDEL

/usr/bin/echo $content | /usr/bin/mailx -s $MESG_GOOD me@here.com


Last edited by dstinsman; 10-05-2006 at 04:50 PM..