Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Take Data From a table and send it through mail

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-09-2013
ginrkf ginrkf is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 23 April 2015, 9:44 AM EDT
Posts: 39
Thanks: 3
Thanked 0 Times in 0 Posts
Take Data From a table and send it through mail

Hi can anyone help me in writing a code for taking data from a table and need to send that data through mail using mail -x command..
Sponsored Links
    #2  
Old Unix and Linux 03-09-2013
panyam panyam is offline Forum Advisor  
Registered User
 
Join Date: Sep 2008
Last Activity: 8 December 2014, 6:40 AM EST
Posts: 1,159
Thanks: 20
Thanked 105 Times in 100 Posts
Table you mean from Data Base ? If so , is it from which DB?

I am assuming that the table exists in Oracle, you can do:

(1) Connect to oracle DB, using sqlplus -s "user_name/passwd"@oracle_sid <<
write your query here to get the data
(2) store the step(1) output into a file
(3) mail the file using mail -x from the file obtained in step Linux2)

Regards,
Sponsored Links
    #3  
Old Unix and Linux 03-09-2013
ginrkf ginrkf is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 23 April 2015, 9:44 AM EDT
Posts: 39
Thanks: 3
Thanked 0 Times in 0 Posts
Thanks

How to store the output into a file .I am using oracle DB

I need to select 9 columns

---------- Post updated at 08:07 AM ---------- Previous update was at 06:22 AM ----------

Thanks

How to store the output into a file .I am using oracle DB

I need to select 9 columns
    #4  
Old Unix and Linux 03-09-2013
Yoda's Unix or Linux Image
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 30 July 2015, 1:41 PM EDT
Location: Galactic Empire
Posts: 3,420
Thanks: 240
Thanked 1,223 Times in 1,149 Posts
SQL*Plus command SPOOL can be used to store query result in file.

Syntax:

Code:
SPOOL filename
--your query here
SPOOL OFF

Note: Search the internet and you will find many examples of spooling along with how to format query results.
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Represent the data in table format as in mail content navsan Shell Programming and Scripting 8 03-15-2013 04:38 PM
Mailx command - send mail as table format qwertyu Shell Programming and Scripting 2 11-29-2012 11:37 AM
Send mail through shell script with HTML table. Kinshuk Saxena Shell Programming and Scripting 2 09-15-2012 02:51 PM
How to send html file in a mail not as an attachment but it should display in the mail in table for mani_isha UNIX for Dummies Questions & Answers 0 03-30-2010 03:37 AM
Arrange Data in table and send by mail xjklop2009 Shell Programming and Scripting 4 11-28-2009 01:50 PM



All times are GMT -4. The time now is 02:11 PM.