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!

#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
1 Like

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.