How to scan data directly from Table using a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to scan data directly from Table using a script
# 1  
Old 10-28-2008
How to scan data directly from Table using a script

Hi,
I have a new task where i have two tables
Acct_ open and lookup table

In the Acct_open table there is all the information about an account including account number
and lookup table is having a country code and corresponding country name where that account has been opened.

both tables are connected with each other with country code as in the Acct_open table first three digits in the account number represents country code.

For e.g.
In Acct_open Table,

account number
300456728
200846745
101758599
-
-
-

and in the lookup table,
Country code country name
300 Singapore
200 Canada
101 US
201 India



now what i need to do is to scan each record in Acct_open table and check the corresponding country name, fetch that record and put into other directory, having same name as country name, in the form of sequential file.


Can anybody help me with this ASAP.


Thanks
# 2  
Old 10-28-2008
By table, you mean a database table? You need to write a join in SQL.
# 3  
Old 10-28-2008
ok...yeah i know that i need to write a join SQL query....but how to put that data into corresponding files depending on the country name.now suppose i have following code for my script:

while read Record1
do
SQLQuery=`echo $Record1 | awk '{printf $0 }'`

db2 " export to SrcRejData.tmp of del $SQLQuery" > $workfile

done
now in this file i have all the records in a temporary file SrcRejData.tmp, including all the records from Acct_open table and Country name from lookup table
is there any way if i can now scan SrcRejData.tmp to fetch the records according to country names and put them into corresponding sequential file
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run the Script from any stage by updating data from Oracle Table.

I have 100 Scripts, each containing 10-15 SQL's in them. Each Script run for 40 mins to 1 hour 30 mins. In the event of Failure in any step, if i re-start the Script, it will start running from the beginning. Which is waste of time. So in order handle this, i made the script to run from the... (7 Replies)
Discussion started by: kiran1992
7 Replies

2. Shell Programming and Scripting

Help with perl script to output data in table format...

Hello, I need help with a perl script that will process a text file and match virtual server name to profile(s). the rest will be ignored. Virtual server name follows the word "virtual" in the begging of the line. There could be multiple profiles assigned to one virtual server. For example, ... (3 Replies)
Discussion started by: besogon
3 Replies

3. Shell Programming and Scripting

Perl Script for reading table format data from file.

Hi, i need a perl script which reads the file, content is given below. and output in new file. TARGET DRIVE IO1 IO2 IO3 IO4 IO5 ------------ --------- --------- --------- --------- --------- 0a.1.8 266 236 ... (3 Replies)
Discussion started by: asak
3 Replies

4. Shell Programming and Scripting

How to get full sql table data using shell script

i have a Oracle table like col1 col2 ---- ----- a 1 b 2 c 3 when i write a script for it , it gives me all the data in one column. Please give me the solution which gives the exact result like we see in sql editors. for a in `echo " set feedback off; set pagesize 40;... (1 Reply)
Discussion started by: ss135r
1 Replies

5. Shell Programming and Scripting

Shell script to export data from Oracle table .

Hi, I want to write a shell script which will export data from oracle table . I don't want to save that data . I want the queries . Right now i am right clicking on the table and clicking on export as to my desktop . Please let me know if any one have any idea . (2 Replies)
Discussion started by: honey26
2 Replies

6. UNIX for Dummies Questions & Answers

Bash script to insert data into an html table

hi, I need to create a bash shell script which picks up data from a text file and in the output file puts it into an html made table. I have to use sed and awk utilties to do this the input text file will contain data in the format: job name para1 para2 para3 para4 para4 1 ... (1 Reply)
Discussion started by: intern123
1 Replies

7. Shell Programming and Scripting

how to print out data from mysql table in perl script

I'm having trouble with this code. if i do .\read.pl -u user it prints out 2010-12-20 12:00:00 host1 <cmd>a 2010-12-20 12:00:01 host1 <cmd> <execute> 2010-12-20 12:00:02 host1 <cmd>b 2010-12-20 12:00:03 host1 <cmd>c however, if i enter .\read.pl -h host1 it should... (3 Replies)
Discussion started by: kpddong
3 Replies

8. Shell Programming and Scripting

Script not reading Data from oracle table properly

Hi, I have a case where i am connecting to the oracle DB and reading a column value.... Script is in production...it was running fine,,,but suddenly now some times its started giving pain.... Script runs dailly....but sometimes its reading data from Oracle DB and sometimes its not rading the... (2 Replies)
Discussion started by: Sagarddd
2 Replies

9. Shell Programming and Scripting

help for writing shell script to export table data

Hi All, I need to write a shell script(ksh) to take the tables backup in oracle(exporting tables data). The tables list is not static, and those are selecting through dynamic sql query. Can any body help how to write this shell script. Thanks, (3 Replies)
Discussion started by: sankarg
3 Replies
Login or Register to Ask a Question