467,209 Members | 1,340 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,209 developers. It's quick & easy.

UNIX shell script and DB2 Queries

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
  • viewed: 4265
Share:

Post your reply

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

Similar topics

2 posts views Thread by Mohsin | last post: by
1 post views Thread by dk | last post: by
2 posts views Thread by timdoyle05 | last post: by
7 posts views Thread by kamkwokho | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.