Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2012
    Posts
    5

    Unanswered: Using spool in shell script

    Hi All,
    I want a script that is used to spool the count of four queries and mail the output .

    but i dont know how to use spool in shell script and mail it

    (1) I want to spool the output of four queries.
    (2) then i have to mail it
    (3) Using shell script

    pls give me the syntax for this


    pls help me

  2. #2
    Join Date
    Feb 2006
    Posts
    173
    Provided Answers: 1
    What do you mean by "spool"?
    Are you talking about, er, um, typing about the "spool" command in oracle SQL*Plus?

  3. #3
    Join Date
    Jan 2012
    Posts
    5
    spool means i want the output of query in another file and then i have to mail it

  4. #4
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Somewhat of a guess
    Code:
    sqlplus script1 >output1
    sqlplus script2 >output2
    sclplus script3 >output3
    sqlplus script4 >output4
    cat output1 output2 output3 output4 |mail -s "4 reports" email@address
    If the reports are large, and/or you don't need to use them separately:
    Code:
    sqlplus sqript1 >output
    sqlplus script2 >>output
    sqlplus script3 >>output
    sqlplus script4 >>output
    mail -s "4 reports" email@address <output

  5. #5
    Join Date
    Feb 2006
    Posts
    173
    Provided Answers: 1
    Quote Originally Posted by xal_kaushal View Post
    spool means i want the output of query in another file and then i have to mail it

    The attached scripts will give you an example, The shell script(example.sh) runs the sqlplus script(example.sql) that creates the flat file, it then zips the file and emails it. The section in the shell script(example.sh) that runs the sqlplus script, zips file, and mails it is enclosed with lines like this: #************************************************* ****************
    hth
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •