Find BA/Folder if giving a specific SQL Statement
-----------------------------------------------------------
select * from
(SELECT
BA.BA_NAME,
OBJ.OBJ_ID OBJ_ID,
OBJ.OBJ_NAME FOLDER_NAME,
1 SEQUENCE_NUMBER,
OBJ.OBJ_OBJECT_SQL1 ||
OBJ.OBJ_OBJECT_SQL2 ||
OBJ.OBJ_OBJECT_SQL3 SQL_CODE
FROM
discadm.eul4_OBJS OBJ,
discadm.EUL4_BAS BA,
discadm.EUL4_BA_OBJ_LINKS BOL
WHERE
OBJ.OBJ_TYPE = 'CUO'
AND OBJ_OBJECT_SQL1 IS NOT NULL
AND BA.BA_ID = BOL.BOL_BA_ID
AND BOL.BOL_OBJ_ID = OBJ.OBJ_ID
UNION
SELECT
BA.BA_NAME,
SEG_OBJ_ID OBJ_ID,
OBJ.OBJ_NAME FOLDER_NAME,
SEG.SEG_SEQUENCE SEQUENCE_NUMBER,
SEG.SEG_CHUNK1 ||
SEG.SEG_CHUNK2 ||
SEG.SEG_CHUNK3 ||
SEG.SEG_CHUNK4 SQL_CODE
FROM
discadm.eul4_SEGMENTS SEG,
discadm.eul4_OBJS OBJ,
discadm.EUL4_BAS BA,
discadm.EUL4_BA_OBJ_LINKS BOL
WHERE
OBJ.OBJ_TYPE = 'CUO'
AND OBJ_OBJECT_SQL1 IS NULL
AND SEG.SEG_OBJ_ID = OBJ.OBJ_ID
AND BA.BA_ID = BOL.BOL_BA_ID
and BOL.BOL_OBJ_ID = OBJ.OBJ_ID
AND SEG.SEG_SEG_TYPE = 1
ORDER BY 2, 3) a
where a.sql_code like '%&aaa%'
and a.sql_code like '%&bbb%'
and a.sql_code like '%&ccc%'
;