Hello members,
I'm working on the Solaris environment and the DB i'm using is Oracle 10g.
Skeleton of what I'm attempting;
Write a ksh script to perform the following. I have no idea how to include my sql query within a shell script and loop through the statements. Have therefore given a jist of what I'm attempting, below.
Copy file to be processed (one file at a time, from a list of 10 files in the folder ).
for i in * do cp $i /home/temp
2 . Create a snapshot(n) table : Initialize n = 1
create table test insert account_no, balance from
records_all;
-- creates my snapshot table and inserts records in SQL
- Checking if the table has been created successfully:
select count(*) from snapshot1
-- query out the number
of records in the table -- always fixed, say at 400000
if( select count(*) from snapshot(n) = 400000 )
echo " table creation successful.. proceed to the next step "
else
echo " problem creating table, exiting the script .. "
If table creation is successful,
echo " select max(value) from results_all " -- printing the max value to console
Process my files using the following jobs:
./runscript.ksh - READ -i $m
( m - initial value 001 )
./runscript.ksh - WRITE -i $m
( m - initial value 001 -- same as READ process_id )
-- increment m by 1
Wait for success log
tail -f log($m)* | -egrep "^SUCCESS"
looping to step1 to : Copy file 2 to temp folder; create snapshot(n+1) table
Exit when all the files have been copied for processing.
done
-- End of Step 1
Pointers on getting me moving will be very valuable.
thanks,
Kris