By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,018 Members | 901 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,018 IT Pros & Developers. It's quick & easy.

UNIX shell script and DB2 Queries

P: 1
Hi,

I am new to DB2 and in a new job and in need of urgent help. Here we have about 100 queries (SQL) that have been manually executed to retrieve totals from different tables and post it to Excel spreadsheet. Is there any way I can create a shell script as a wrapper and execute these queries and create a report all at one time instead of running the queries 100 times? Any help is appreciated.

Here are some sample queries that I would like to use in unix script:

SELECT MSR_PRD_ID , COUNT(*) COUNT, SUM(SHDW_BAL) SHDW_BAL
FROM RDR.AR_TVR_PRFL WHERE SRC_STM_ID=7 GROUP BY MSR_PRD_ID


SELECT count(*), a.src_stm_id, SUM(SHD_AMT) SUM_SHD_AMT FROM
RDR.AR_AVY_SCHD A, RDR.AR B WHERE a.src_stm_id=7 and
A.AR_ID=B.AR_ID
AND AR_LCS_TP_ID<>(select cl_id from rdr.cl where src_stm_id=7 and cl_code = 'PURGED')
group by a.src_stm_id;


SELECT MSR_PRD_ID, SUM(COFF_AMT) SUM_COFF_AMT,COUNT(*) COUNT
FROM RDR.AR_DLQ_PRFL WHERE SRC_STM_ID=7 GROUP BY MSR_PRD_ID

Thanks in advance,

GG
Mar 13 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.