KSH - How to call different scripts from master scripts based on a column in an Oracle table


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting KSH - How to call different scripts from master scripts based on a column in an Oracle table
# 1  
Old 06-20-2011
KSH - How to call different scripts from master scripts based on a column in an Oracle table


Dear Members,

I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc.

I would like to create a script which will will call other scripts based on the request action.

Can we directly read from the REQUEST_ACTION attr. or do we have to first fetch the record in a text file and then read the text file to call other scripts?

Please help me with the script as I am a novice to scripting.

Thanks!
# 2  
Old 06-20-2011
Try this ...

Code:
#capture the script request in a unix host variable from database 
v_script_request==`sqlplus -s user/password@dbname <<!
set feedback off heading off pagesize 0 
select REQUEST_ACTION from REQUESTS;
exit;
!`


##execute respective shell script basing on the parameter 
if "$v_script_request" = 'ME'
then
##execute script 
sh /home/scott/script_name.sh
elif "$v_script_request" = 'MD'
##execute script 
sh /home/scott/script_name.sh
elif "$v_script_request" = 'NE'
##execute script 
sh /home/scott/script_name.sh
fi

This User Gave Thanks to palanisvr For This Post:
# 3  
Old 06-20-2011
MySQL


Thanks palanisvr.

I will work on this script and expand it as per my requirements.
I will let you know how is goes (and may even bother you if I am stuck at some point).

Thank you very much for prompt response.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

ksh scripts migrating(Oracle 11G) from Solaris Sparc 10 to RHEL 7

Hi All, Now we are migrating oracle 11G from Solaris Sparc 10 to RHEL 7. We have 1000+ ksh scripts.. Could you please let em know what would be the best way to use exiting scripts in RHEL with minimal changes,. my concern was "Is it all Solaris command work in RHEL". (3 Replies)
Discussion started by: mssprince
3 Replies

2. Shell Programming and Scripting

Call functions from other scripts

i have a file that contains functions and i want the functions to be available in another script. of course, the ideal situation here would be to put the functions in the same script, but i dont own these scripts. so I have to call the functions file from a different script. how do i... (3 Replies)
Discussion started by: SkySmart
3 Replies

3. Shell Programming and Scripting

How to call different scripts?

I have 3 different scripts with 3 different functions, I would like to merge these 3 and make a master script. The following are my ideas: - ask user to pick which script he needs - after choosing, point it to the right script or... depending on the inputs provided by the user, all three... (1 Reply)
Discussion started by: priyanka.premra
1 Replies

4. Shell Programming and Scripting

clean passwd file based on db table (master)

The purpose of this script is to scan the /etc/passwd file one line at a time comparing the usernames to the usernames found in a database table. I will later locked every account which is not in the database table. I have export the userlist from the database in a file (/tmp/userlist). It... (1 Reply)
Discussion started by: Banks187
1 Replies

5. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

6. Shell Programming and Scripting

Connect to DB2 table using Shell scripts

Can anyone please help me with an unix shell script to connect a DB2 database. My requirement is just to display the no of records present in a table of a DB2 database through Unix Shell script. Thx - Ram (1 Reply)
Discussion started by: onlyraja
1 Replies

7. Shell Programming and Scripting

Call Multiple Scripts With Similar Name

I have a lot of scripts in one directory I was just wondering if there was a single command that could call each script. Example: There are scripts, "stopThisService.sh", "stopThatService.sh", "stopAnotherService.sh", and "stopYetAnotherService.sh". I'd like to be able to call them all by... (1 Reply)
Discussion started by: mrwatkin
1 Replies

8. Shell Programming and Scripting

To call many scripts from mother one simultaneously

Hi, I need to rin few other scripts from one main (mather) script. Working in ksh on LINUX. The only one condition - it should be run in parallel. I mean I have to be able to call 20 scripts from this mother script in parallel (start them in the same time). Does somebody know how to do it? ... (2 Replies)
Discussion started by: juliyp
2 Replies

9. Shell Programming and Scripting

How to call C functions in shell scripts?

How can i call dynamic C functions in shell scripts? (5 Replies)
Discussion started by: agarwal
5 Replies
Login or Register to Ask a Question