Calling SQL script from ksh job and send mail on some error.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Calling SQL script from ksh job and send mail on some error.
# 1  
Old 06-28-2010
Calling SQL script from ksh job and send mail on some error.

Hi,
I am trying to call sql script from ksh job with parameters.The parameters passed from ksh job will be used in SELECT query in sql file to SPOOL the data in extract file.My questions are:

1) How to call a sql script from ksh job with parameters?
2) How to use the parameter in sql file to extract data from oracle tables to create txt file?
3)How to provide name to the extract file with current date format?e.g, EXTRACT_<YYYYMMDDhhmm>.txt in sql file?
4)How to check whether the called sql script with SPOOL action is successfully completed or not in ksh job?
5)How to send mail to support group on unsuccessful completion of sql performed from ksh job?

Can anyone give me some examples (Sample code) with proper syntax and details which will help me understand this concept?

Thanks in advance.

Regards,
Anil
# 2  
Old 06-28-2010
Hi Anil
Check these examples here to get a fair idea on how to use sql inside shell

Guru.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Oracle/SQLPlus help - ksh Script calling .sql file not 'pausing' at ACCEPT, can't figure out why

Hi, I am trying to write a script that calls an Oracle SQL file who in turns call another SQL file. This same SQL file has to be run against the same database but using different username and password at each loop. The first SQL file is basically a connection test and it is supposed to sort... (2 Replies)
Discussion started by: newbie_01
2 Replies

2. UNIX Desktop Questions & Answers

Need to send mail only when the job is not running

I have set up a cron, which will send the mail with not runnnig jobs in the script.sh 15,30,45 * * * * /a/b/c/script.sh | grep not | mail -s "test mail" learner987@gmail.com But i dont want mail when all the jobs are running, but with the above cron i will get mails without the content(if all... (2 Replies)
Discussion started by: learner987
2 Replies

3. UNIX for Beginners Questions & Answers

Grep the 'not running' jobs and will send the update in mail with its name(job)

my request is: i have to create a script , which will grep the 'not running' jobs and will send the update in mail with its name(job) Scenario: logged in to machine abc went to particular path: cd /a/b/c then ./script1.sh status (script.sh is a script,whose status gives info about 10 jobs... (1 Reply)
Discussion started by: learner987
1 Replies

4. Shell Programming and Scripting

Run sql script and send to mail if not empty?

Thanks again for helping me out. I was wondering if anyone else has encountered this issue. I have a SQL script that produces a list -however we are only interested in that list if the length is not zero Here is the sql file named dailyBalance.sql select * from Balance where... (1 Reply)
Discussion started by: Astrocloud
1 Replies

5. Shell Programming and Scripting

how to run a script using cron job and send the output as attachment via e-mail using unix

how to run a script using cron job and send the output as attachment via e-mail using unix. please help me. how my cron job entry should be? As of now my cron job entry is to run the script at specific time, 15 03 * * * /path/sample.sh | mail -s "Logs" email_id In the above entry, what... (8 Replies)
Discussion started by: vidhyaS
8 Replies

6. Shell Programming and Scripting

How to write cron job for calling sql function database is postgres

Hi, Please help me to write cron job for calling sql function daily. I have Postgres database. (1 Reply)
Discussion started by: kulbhushan
1 Replies

7. Shell Programming and Scripting

Send an e-mail using ksh

Hi, I have a small script that outputs to a text file. I need to e-mail the contents of the text file to a mail alias. However, I cannot seem to get the script to print the 'subject', my script just leaves it blank. Has anybody any ideas what is wrong? if then (echo "\nHere is the report... (3 Replies)
Discussion started by: asulli01
3 Replies

8. Solaris

metastat error information send to mail script

Hi frnds, I want excute the command through shell script. command is #metastat once u excute this cmd we will get some information on raid configuration status. Once it is working properly we will get status 'okey' otherwise will get status 'error'. i want to script for once we get... (5 Replies)
Discussion started by: arjunreddy3
5 Replies

9. Shell Programming and Scripting

Calling SQL LDR and SQL plus scripts in a shell script

Hi- I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment... I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Discussion started by: rajagavini
5 Replies

10. Shell Programming and Scripting

calling a PL/SQL stored procedure from KSH

Hi I have a stored procedure which should be called from KSH. Could ayone please help me with this. Thanks (1 Reply)
Discussion started by: BlAhEr
1 Replies
Login or Register to Ask a Question