1

can anyone help me in wiring a shell script to acess sqlplus . In sqlplus i need to run a sql script and mail the result back to a mail id.

example

ls dir ----> has  abc.sql

i go to sqlplus and run query by ==> **sqlplus username/password@instance @abc**

I want to mail the result to [email protected]

2 Answers 2

3

You should be able to do:

sqlplus username/password@instance @abc | mail -s "Email Subject" [email protected]
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the reply. But when I try the above line , the system doesn't do anything. Then i had to cancel ^Z[1] + Stopped (SIGTSTP) sqlplus username/password@instance @abc | mail -s "Email Subject" [email protected]
@misguided: If you do the sqlplus command by itself, do you get output to the screen? If you do echo "hello" | mail -s "test message" [email protected], do you get that email?
0

You shuld redirect the output of sqlplus to a file And then use mailx to send that to specified email id.

1 Comment

don't need the file, just pipe directly to mailx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.