# Miscellaneous > SQL Scripts >  Multipul Query's in one single statement

## sunkara

Hi ,

i have to run multipul select Query's in sigle statement,

but we are not suppose to use trigger for that ,can nyone help me on this ..


Rdbms is DB2 and on Mainframes.

please find query's below 

All these has to be run in one statement as per req..........

	SELECT CUST.APPLICATION_ID,CUST.CIN,CUST.CREDIT_CUST_TYPE  ,APP.BRANCH_ID FROM GTDFCIA.APP_CUST_TXN CUST, GTDFCIA.APPLICATION_TXN APP  WHERE  CUST.APPLICATION_ID=APP.APPLICATION_ID AND SCHUFA_SRCE_FLAG = 'M' AND SCHUFA_BATCH_FLG is null  

SELECT A.CIN AS CIN,A.LAST_NAME AS SUR_NAME,A.FIRST_NAME AS FIRST_NAME,A.SEX AS GENDER,A.PLACE_OF_BIRTH AS PLACE_OF_BIRTH,A.DATE_OF_BIRTH AS DATE_OF_BIRTH,B.STREET_HOUSENO AS STREET_CURRENT,B.ZIPCODE AS ZIP_CODE_CURRENT,B.CITY AS CITY_CURRENT, A.BUREAU_REQ_ATTR BUREAU_REQ_ATTR, B.COUNTRY AS COUNTRY_CURRENT FROM GTDFCIA.APP_CUST_TXN A, GTDFCIA.CUST_ADDRESS_TXN B WHERE  A.APPLICATION_ID = B.APPLICATION_ID AND A.CIN = B.CIN  AND B.ADDRESS_TYPE  = '001'  AND A.APPLICATION_ID = 'B2007052815444754100' AND A.CIN = '100133788'

SELECT A.CIN AS CIN,A.LAST_NAME AS SUR_NAME,A.FIRST_NAME AS FIRST_NAME,A.SEX AS GENDER,A.PLACE_OF_BIRTH AS PLACE_OF_BIRTH,A.DATE_OF_BIRTH AS DATE_OF_BIRTH,B.STREET_HOUSENO AS STREET_CURRENT,B.ZIPCODE AS ZIP_CODE_CURRENT,B.CITY AS CITY_CURRENT,B.COUNTRY AS COUNTRY_CURRENT FROM GTDFCIA.APP_CUST_TXN A, GTDFCIA.CUST_ADDRESS_TXN B WHERE  A.APPLICATION_ID = B.APPLICATION_ID AND A.CIN = B.CIN  AND B.ADDRESS_TYPE  = '002'  AND A.APPLICATION_ID = 'B2007052815444754100' AND A.CIN = '100133788' 


	SELECT WISH_FROM, WISH_TYPE, PURPOSE, AMOUNT, CURRENCY, DDA_TYPE, CUSTOMER_WISH, LIMIT_TYPE, MODIFY_BY_USRID, MODIFY_DT FROM GTDFCIA.APP_CUST_WISH_TXN  WHERE APPLICATION_ID = 'B2007052815444754100' AND WISH_FROM = 'KLS' AND DELETE_FLG = 'N' 

	SELECT ALIMONY_AMT_CCY, ALIM_EXSPOUSE_CCY, ALIMONY_AMOUNT, ALIMONY_EX_SPOUSE, BANK_WORK_IND, BIRTH_NAME, BLACKLIST_STATUS, BNK_ACC_VAL_CTR, CAPITAL_BALANC_CCY, CAPITAL_BALANCE, CARD_NO, CARD_TYPE, CHECK_STATUS_DM, CHECK_STATUS_EMP, CHILDREN_W_ALIMONY, CIV_BLACKLIST, COUNTRY_OF_BIRTH, CRED_CARD_VAL_CTR, CREDIT_CTRT_W_CITI, CREDIT_CUST_TYPE, CUST_IN_BRANCH, CUST_MATCH_CNTR, CUST_SCHUF_PRF_FLG, CUST_TITLE, CUST_VIA_PH, CUSTOMER_STATUS, CUSTOMER_TYPE, DATE_OF_BIRTH, EMAIL_ID, END_DT_EMPLYT_PRMT, END_DT_RESD_TITL, FCP_ADD_CHK, FIRST_NAME, ID_CHECK_VAL_CTR, IN_GERMANY_SINCE, INFOSCORE_REQ_TIME, INFOSCORE_STATUS, KNOWN_IDENTITY, LAST_NAME, MARITAL_STATUS, MILITARY_SERVICE, MODIFY_BY_USRID, MODIFY_DT, NATIONALITY, NO_OF_CHILDREN, NO_OF_DEPENDENTS, NO_OF_VEHICLES, PERSONS_IN_HOUSE, PH_MOB_AREACODE, PH_MOB_COUNTRYCODE, PH_MOB_NO, PH_RESD_AREACODE, PH_RESD_CCD, PH_RESD_NO, PLACE_OF_BIRTH, PREFIX, RESD_TITLE, RESD_TYPE, SCHUFA_CHECK_FLAG, SCHUFA_MLI_REQ_TM, SCHUFA_MLI_STATUS, SCHUFA_NOMATCH_CTR, SCHUFA_SRCE_FLAG, SDN_STATUS, SEX, SOC_SEC_VAL_CTR, SOCIAL_SECURITY_NO, SSN_ERROR_COUNT, STAFF_IND, VEHICLE_TYPE, CUST_SUB_TYP, INTR_ADD_CHK_FLG, BUREAU_REQ_ATTR FROM GTDFCIA.APP_CUST_TXN  WHERE APPLICATION_ID = 'B2007052815444754100' AND CIN = '100133788' AND COALESCE(DELETE_FLG,'N') = 'N' 

	SELECT PARAM_GROUP_CD,PARAM_CD,PARAM_VALUE FROM GTDFCIA.PARAM_CODE_MST WHERE ACTIVE='Y' AND ACTION='A' AND PARAM_GROUP_CD NOT IN ('G056','G051','G012') ORDER BY PARAM_GROUP_CD , PARAM_VALUE 

SELECT PARAM_GROUP_CD,PARAM_CD,PARAM_VALUE FROM GTDFCIA.PARAM_CODE_MST WHERE ACTIVE='Y' AND ACTION='A' AND PARAM_GROUP_CD IN ('G056','G051','G012') ORDER BY PARAM_GROUP_CD, PARAM_CD

----------


## rmiao

What do you mean in one single statement? Do you mean in single batch? Other things close are union, join or subquery.

----------


## sunkara

Yes These have to run in Single batch

----------


## rmiao

Check db2 manual on how to run queries in batch (or in single transaction).

----------

