[askdba] Re: SQL data to Unix variables question

  • From: Regis Biassala <Regis.Biassala@xxxxxxxxxx>
  • To: askdba@xxxxxxxxxxxxx
  • Date: Thu, 7 Oct 2004 12:11:25 +0100

Nice one !!!
This what I wanted...thanks Regis

-----Original Message-----
From: askdba-bounce@xxxxxxxxxxxxx [mailto:askdba-bounce@xxxxxxxxxxxxx] On
Behalf Of Irfan Khan
Sent: 07 October 2004 12:04
To: askdba@xxxxxxxxxxxxx
Subject: [askdba] Re: SQL data to Unix variables question

sqlplus -s xxxx/xxxx@prod @$ABV_TOP/$oracle_sid/tmp/extract.sql > =
$mail_file
awk -F'|' '{print $1"|"$2}' $mail_file | sort | uniq | grep [a-z] > =
$uniqfile
while read fileline1
do
       mailadd=3D`echo "$fileline1" | cut -f1 -d'|'`
       mailsub=3D`echo "$fileline1" | cut -f2 -d'|'`
       echo $mailadd
       echo $mailsub
       grep -h "$fileline1" $mail_file | awk -F'|' '{print $3"    "$4"   =
 "$5}' > $currmail
       mailx -s "$mailsub" "$mailadd" < $currmail
done < $uniqfile

Irfan, Khan
Senior ERP & Database Administrator
Converge Asia Pte. Ltd.
29 International Business Park
#02-03 Acer Building Tower B
irfan.khan@xxxxxxxxxxxx
Phone :- 65 67998078
Fax :- 65 67998096
www.converge.com

-----Original Message-----
From: Regis Biassala [mailto:Regis.Biassala@xxxxxxxxxx]
Sent: Thursday, October 07, 2004 6:55 PM
To: askdba@xxxxxxxxxxxxx
Subject: [askdba] SQL data to Unix variables question


Hi,
Maybe one of you might already have this somewhere and certainly will =
help
me save time to develop one of me own.

My Question:
Suppose a query like this:

Select name, sal from emp;

Result:
Name                    Sal
-----------             -----
Mikey           110
Justin          120
Louis             100

I'd like to store that info in Unix variables (int and string as you may =
see
there).
NOTE: we've got 3 rows, and this certainly will loop to process each row =
in
unix.

Does one know how to accomplish this?

Thanks,
Regis
-----------------------
Regis Biassala (DBA)
Direct: +353 1 8063613



Other related posts: