Help with logic

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with logic
# 1  
Old 11-29-2013
Help with logic

I am on solaris and i have this piece of code.

sqlplus -s $ARBOR_USR/$ARBOR_DB_PASSWD@$ORACLE_SID<<EOF>$CUR_DIR/sql_output.txt
set feedback off
set heading off
select distinct account_no from adj  WHERE ADJ_TRANS_CODE=-2401 and request_status=1 and bill_ref_no=0
order by account_no;

if [ $? -eq 0 ]
echo " SQLPLUS Connection Successful "
echo " SQLPLUS Connection Failed "

##echo " The account numbers passed to   BIP are  "

if [  ! -s  "$CUR_DIR/sql_output.txt" ]
echo "No account number for bad debt"
for i in `cat $CUR_DIR/sql_output.txt`
sqlplus -s $ARBOR_USR/$ARBOR_DB_PASSWD@$ORACLE_SID<<EOF1>$CUR_DIR/sql_interim.txt
select $i,trunc(sysdate),1,trunc(sysdate),0,0 from dual;

echo "bip $i is running"
sh  $SCRIPT_DIR/ 01 0 $i >  $CUR_DIR/bip_log_1.txt
sleep 200

I want to insert the account number into CMF_INTERIM_BILLS.TRACKING_ID,TRACKING_ID_SERV columns are composite primary key in the table CMF_INTERIM_BILLS.

The logic behind this is that
Only 1 row is to be inserted into CMF_INTERIM_BILLS table then the script runs for a particular account number .When the runs the entry for that particular account number
is deleted from CMF_INTERIM_BILLS automatically.

How to implement this logic? Please correct my above code.
# 2  
Old 11-29-2013
The usual solution is to write a script to generate you SQL for the insert. If you insert ... select ... UNION select .... you can do multiple rows at a time. Then you just pipe it to sqlplus.

There are file loaders, too. I forget the name, but Oracle External Tables (mapping files as tables) are very fast and pretty easy, but requires access to the configured dir on the server. JAVA can pass in blocks that can be insert'd, select'd as tables, too.
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need help in logic

I have big large snapshot file which contains every process start time and end time. One server snapshot contains many Application handle. My task is to identify the process id for which the end time is not there or empty also if the completion time is not on the same date then I need to kill. ... (6 Replies)
Discussion started by: senthilkumar_ak
6 Replies
Login or Register to Ask a Question