Thursday, June 21, 2012

Unix Day - 2 - DB Connection and File Reading

Reading file and passing parameter to Oracle SQL to fetch the data.

#!/bin/sh
rm -r FinalDepInfo.txt
for row in `cat myDep.txt`
do

a=$(C:/oraclexe/app/oracle/product/10.2.0/server/BIN/sqlplus -s hr/magogate@XE <<QUERY
spool mytest.txt
select first_name, last_name, email
from employees
where department_id = $row;
spool off;
exit;
QUERY);
less mytest.txt >> FinalDepInfo.txt
done;


Reading file line by line

#!/bin/sh
while read line
do
    echo $line
done < FinalDepInfo.txt

1 comment:

  1. Best Casino in L.A. to Play Slots at MapYRO
    Looking for 사천 출장안마 a great casino to play slots online at? of 원주 출장안마 these casino that 제주 출장마사지 offers 아산 출장마사지 online 당진 출장샵 slots at MapYRO and Casino Player Ratings for November

    ReplyDelete

All about CSS

From book HTML & CSS - Design and Build Websites - Jon Duckett CSS works by associating rules with HTML elements. These rules govern how...