i'm reading lines in a file and then for each line, it has to connect to sqlplus and query ...
i've attached the code...i have 2 issues...
is there a more efficient way to do this wkithout having to connect to sqlplus for each line? I mean is there a way to open one sqlplus session, read the files line by line and process and after parsing the file, close the connection.
The other problem i have is for some lines it throws an error saying "Error initializing sqlplus - Internal error" and it moves on to the next line. It might be related to the fact that i'm opening a new connection to sqlplus for each session
Can someone please advice?
while read line; do
substrstart=$(echo $line|cut -c 1-2)
SERVICENO=$(echo $line|cut -c 3-12)
if (["$substrstart" = "25"]
set pagesize 0
select psdreqt_recordtype,psdreqt_psd,adt.asdt_recordtype from psdrequest_transactions,(select asdt_recordtype,asdt_gainingpsd from asdresponse_transactions where asdt_cli='$SERVICENO' and asdt_uid=(select max(asdt_uid) from asdresponse_transactions where asdt_cli='$SERVICENO')) adt where psdreqt_cli='$SERVICENO' and psdreqt_recordtype in('10','50') and psdreqt_uid=(select max(psdreqt_uid) from psdrequest_transactions where psdreqt_cli='$SERVICENO' and psdreqt_recordtype in('10','50'));"|
sqlplus -s test/test@tst01 | read PSDTRECORDTYPE PSDTGAININGPSD ASDTRECORDTYPE
if [ "$ASDTRECORDTYPE" != "25" ] && ([ "$PSDTGAININGPSD" = "007" ] || [ "$PSDTGAININGPSD" = "003" ]); then
echo $line >> $IN007003
echo $line >> $IN007002