SQL commands in Scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SQL commands in Scripting
# 1  
Old 12-14-2009
SQL commands in Scripting

Hi ,

Daily I sneding report to client about the status of State 2 jobs in Control M .

I would like to schedule it via cron . I am using teh following command :

sudo su - <control M server Name>
then reach to the control M server

then run

#isql
<It ask for the password >

Password :

When I give the password I execute the following command

1> select JOBNAME from CMR_AJF where STATE='2'
2> go

It gives the following out put

JOBNAME
----------------------------------------------------------------
AI_BRS_BNP_CompanyOption_PDF
AI_BRS_BNP_DiscountSecurityBlock_PDF
AI_BRS_BNP_EquityListedBlock_PDF
AI_BRS_BNP_FixedInterest_PDF
AI_UNITPRICE_Transfer
(5 rows affected)


Inormally paste this in my mail box and send an email to the client.

How I will write a script by which I can send the the output in one file and then outomatcially send mail via mailx.

Thanks in Advance
# 2  
Old 12-14-2009
Two options:

1. Add a "post process" condition and action on the job in Control-M , which will fire the necessary alert mail.
2. If you want to configure using script, try something like below:

Code:
sqlplus username/password@db_connectionstring <<EOF
select ....;
exit;
EOF

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Multiple SQL Commands

Hello Experts !!! Im new to this so, please bear with me ! I have the following 2 sql statements create table CMD_NEW_USER as Select FD.EMPLOYEE, FD.PASTUSER, ..... FROM REPORTS FS, TASKLIST FD WHERE FS.EMPLOYEEID = FD.EMPLOYEEID ; create table CMD_OLD_USER as Select FD.EMPLOYEE,... (4 Replies)
Discussion started by: OMLEELA
4 Replies

2. Shell Programming and Scripting

SQL commands in a shell scripting

Hi, I need to write a shell script file that does 1)Connects to DB using SQL plus 2)Do some SQL query like select * from.... 3)Based on the output that I got from the sql query I will have to write a if else loop. Plz let me know how to write the shell scripting for this. Thanks for... (1 Reply)
Discussion started by: villain41
1 Replies

3. AIX

how can i install sqlplus and execute some sql commands

hi everybody, i am Talip, a begginner at unix based systems and i have a problem (actually, we may think myself as the problem, in this situation). i am not sure if this is the correct platform for my questions. if it is not please forgive me about this inappropriate mail. what i have: *... (2 Replies)
Discussion started by: talipk
2 Replies

4. Shell Programming and Scripting

sql scripting help

I would like to run the following as bash script sql -U history update feed_domain_configuration set enabled=1 where domain='lon' and vendor_name='<lond' -sam (3 Replies)
Discussion started by: sam786
3 Replies

5. Shell Programming and Scripting

how to sql commands in shell script

hi, plz let me know one example in using sql command in shell script thanks inadvance -bali. (1 Reply)
Discussion started by: balireddy_77
1 Replies

6. Shell Programming and Scripting

SQL Commands in Unix

Hi gurus, Being a newbie not sure whether iam asking the right question? can we use oracle commands in unix for ex: to read a count on a table. if so, what needs to be configured and etc.. any kind of help is appreciated. Thanks sish (6 Replies)
Discussion started by: sish78
6 Replies

7. Shell Programming and Scripting

Shell scripting and SQL

Hi, I have a file that has contents like this: SQL> select * from details; NAME REG -------------------- ---------- Mani 1 Santosh 2 Manju 3 Mukesh 4 SQL> spool off; ... (5 Replies)
Discussion started by: sendhilmani123
5 Replies

8. Shell Programming and Scripting

Sql with shell scripting

Hi, I want to extract data from database table to a flat file using shell scripting. For loading data from file to a table, I had used SQL Loader. How can I do the vice versa using shell scripting. Thanks in advance (3 Replies)
Discussion started by: sendhil
3 Replies
Login or Register to Ask a Question