Need Oracle DB report output which will paste in outlook mail.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Need Oracle DB report output which will paste in outlook mail.

hemant singh
Hello,

Need Oracle DB report output which will paste in outlook mail. But not as an attachment.

e.g.
hello all,
please find daily configuration report.
Oracle output /* this part will everyday change*/
regards,
XYZ


Regards,
Hemant
Reply | Threaded
Open this post in threaded view
|

Re: Need Oracle DB report output which will paste in outlook mail.

Guru
Administrator
Hi Hemant
   To know where to begin with,

2. To know how to send mail from script, start with Mailing from command line in Unix.
3. To know how to get database result to a file: How to dump table data to a CSV file

  In case you need further help, post the code sample which you have tried, and also paste the issue you are facing.

Guru.

On Wed, Jan 16, 2013 at 12:50 PM, hemant singh [via The UNIX School Forum] <[hidden email]> wrote:
Hello,

Need Oracle DB report output which will paste in outlook mail. But not as an attachment.

e.g.
hello all,
please find daily configuration report.
Oracle output /* this part will everyday change*/
regards,
XYZ


Regards,
Hemant



If you reply to this email, your message will be added to the discussion below:
http://forum.theunixschool.com/Need-Oracle-DB-report-output-which-will-paste-in-outlook-mail-tp52.html
To start a new topic under The UNIX School Forum, email [hidden email]
To unsubscribe from The UNIX School Forum, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Need Oracle DB report output which will paste in outlook mail.

hemant singh
Thanks a lot for the quick response.

This is my code for database connection & .csv file generation
*************************
#!/bin/ksh

sqlplus -s <<-! > sql_results.csv 2>&1
user/password@database

select des, name, pdate from table
exit
!

# output file for Oracle errors.
grep 'ORA-' sql_results.csv > /dev/null 2>&1
if [ $? -eq 0 ] ; then
echo "`date` - Oracle error: Check sql_result.csv" >> log_file.txt
exit 1
fi

*******************************
and for mail using below code

********************************
cat msg_body.txt| mailx -m -r aaa.yyy@abc.com -s "Plan for UAT" abc.xyz@abc.com

********************************

and in my msg_body.txt contain

please find below data

do the uat

thanks
Hemant


Now i want to paste contain of  .cvs file data in between "please find  below data" and "do the uat".





Reply | Threaded
Open this post in threaded view
|

Re: Need Oracle DB report output which will paste in outlook mail.

Guru
Administrator
Hi Hemat
 
Remove the following line in your code:

cat msg_body.txt| mailx -m -r [hidden email] -s "Plan for UAT" [hidden email]

And replace it with the following  till EOF (where msg_body.txt is the file containing the Oracle query output):

mailx -m -r [hidden email] -s "Plan for UAT" [hidden email] <<EOF
hello all, 
please find daily configuration report. 

`cat msg_body.txt`

regards, 
XYZ
EOF


Hope this helps.

Guru.