Wrapper script Oracle look KSH


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Wrapper script Oracle look KSH
# 1  
Old 10-04-2011
Wrapper script Oracle look KSH

I have a KSH script that I want to call in a loop for each row in the above table

---
new_script.ksh (psuedo code)

the contents on this new script would be something like below...

for t in (select table_name,schema_name from laod_table)
loop

/bin/load_table.ksh t.table_name t.schema_name

end loop

end

Can this be done in unix?
# 2  
Old 10-04-2011
Please be more specific

Please be more specific with your sql statement. Meaning are you running your code from the O/S to the Oracle server? Please show your code.

Oracle2066SmilieSmilieSmilieSmilieSmilie
# 3  
Old 10-04-2011
Thanks for the quick response...basically what i am trying
to do is to create a new KSH script that will call a existing KSH script in a loop based on a
set of values from a SQL stmt...
..The KSH scripts will run in the AIX box..within the script i have to make a SQLPLUS connection to the database to run the select and then run the existing
KSH script in a loop...
# 4  
Old 10-04-2011
Please be more specific

Please cut & paste your code here. to see what it is doing. Moreover, What Ver is the Oracle DB are you running are you passing bind variables? calling stored procedures, functions or packages?

Oracle2066SmilieSmilieSmilie

---------- Post updated at 05:26 PM ---------- Previous update was at 03:59 PM ----------

Try this code below roadmap to success!!!!!!

Code:
#!/bin/ksh
if [ $# != 2 ]
then 
echo “Please Only Call Or Contact When Oracle RAC Job Comes”
exit 1
fi
l_headhunters=$1
l_candidates=$2
l_candidates_n/a=$3
for i in 'seq $l_start_canidates_search
do
let l_next_candidates=$i+1;
l_candidate_log_file="/xxx/xxx/xxx/canlog_${2}_${i}_$l_next_candidate}.log"
-- connect to Oracle 11g r2
PROMPT "Connecting to Reventon RAC Clusters"
--
Sqlplus –s / as sysdba << EOC -- connect to database
set head off
set pages 0
set lines 132
set echo off
set feedback off
spool /xxx/xxxxxxx/Oracle_RAC_DBA_Candidates.log
Select name, address, city 
from Hr.locations 
where city = ‘New York, NY’
(‘select name, Job_id from hr.employees
Join hr.departments
where hr.employees hr.departments = ‘Oracle RAC DBA’);
spool off
EOC
done


Oracle2066SmilieSmilieSmilieSmilie

Last edited by Franklin52; 10-05-2011 at 04:10 AM.. Reason: Please use code tags, thank you
# 5  
Old 10-06-2011
Did this work for you

SmilieSmilieSmilieSmilie

Oracle2066
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Passing output parameter(Oracle) to variable in ksh Script

Hello, I have researched and tried many way to pass OUT parameter to be stored in variable in KSH Script.Still not success, please help. Here is my Store Procedure. create procedure testout3(v_in varchar2,v_out OUT integer) as begin v_out := 1; end; Here is my testvout.ksh #!/bin/ksh... (1 Reply)
Discussion started by: palita2601
1 Replies

2. 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

3. Shell Programming and Scripting

Calling Oracle stored procedure from ksh script

Friends, I'm newbie with ksh so wanting some help.... 1. I'm trying to call oracle stored procedure from ksh script by taking variable value from runtime, feed into script and execute procedure. 2. Put name1 and name2 value from script run replacing $3 & $4 I'm trying to put name1 in... (4 Replies)
Discussion started by: homer4all
4 Replies

4. Shell Programming and Scripting

Script to load daily average I/O stats from a .ksh file into Oracle db

Hi can anyone help me with a script to load output of the .ksh file into an Oracle database. I have attached sample output of the information that i need to load to the database (2 Replies)
Discussion started by: LucyYani
2 Replies

5. UNIX for Advanced & Expert Users

Pass parameter to the main script from wrapper script

Hi, I am writing a wrapper script(wrap_script.sh) to one of the main scripts (main_script.sh) The main script is executed as following: ./main_script.sh <LIST> <STARTDATE> <ENDDATE> looks for a parameter which is a LIST(consists of different list names that need to be processed), START/END... (0 Replies)
Discussion started by: stunnerz_84
0 Replies

6. Shell Programming and Scripting

HELP. Oracle Call from ksh script

I have searched the forums and couldn't find my specific issue so I figure that I would post on it. I am trying to run a simple sql script that spools to a flat file from a unix script. I have tried to make the call outright from inside of the ksh script as such: sqlplus... (3 Replies)
Discussion started by: BkontheShell718
3 Replies

7. Shell Programming and Scripting

Handling values with space while passing commandline argument from wrapper script in KSH

Hi there, I have a wapper script which passes the argument from command prompt to inner script.. It works fine as long as the argument containing single word. But when value contains multiple word with space, not working as expected. I tried my best, couldn't find the reason. Gurus, pls.... (2 Replies)
Discussion started by: kans
2 Replies

8. Shell Programming and Scripting

New wrapper script will be developed to wrap two ksh scripts

Hi friend,:) The script should invoke these scripts sequentially! When one will finish the second will start. Please help me with it, thanks,:b: Ishai (3 Replies)
Discussion started by: ishai82
3 Replies

9. UNIX for Dummies Questions & Answers

What is a wrapper script

I tried searching the forum ,,but couldn't locate ..Can anyone give me a link or some information about wrapper script. (1 Reply)
Discussion started by: thana
1 Replies

10. Shell Programming and Scripting

HOw to connect oracle using ksh and perl script

HI, So far i have been worked on sybase with perl and ksh scripts, i don't know how to connect using oralce, if any body could explain that is great. Thanks in advance. chendra (3 Replies)
Discussion started by: chendra.putta
3 Replies
Login or Register to Ask a Question

Featured Tech Videos