--
--001
--
select 
xcms_id, 
xcms_name1, 
xcms_name2, 
xcms_name3, 
xcom_value, 
XCMT_LONGDESC,
(select WDCL_FILENAME from wdcl,wdcg where xcms_id=wdcl.WDCL_TABLE_ID and wdcl.WDCL_TABLENAME='XCMS' 
 and wdcl.WDCL_WDCG_ID=wdcg.WDCG_ID and wdcg.WDCG_ROLE=2 and rownum=1)a,
(select WDCL_ID from wdcl,wdcg where xcms_id=wdcl.WDCL_TABLE_ID and wdcl.WDCL_TABLENAME='XCMS' 
 and wdcl.WDCL_WDCG_ID=wdcg.WDCG_ID and wdcg.WDCG_ROLE=2 and rownum=1)b
from 
xcms, xcom, xcmt
where
xcom_xcms_id=xcms_id and xcmt_id=xcom_xcmt_id and
xcmt_type=4 and
v8_sys_StripTelephoneNo(xcom_value, (select WUSS_VALUE from WUSS where upper(wuss.WUSS_NAME)='TAPINUMBEROFDIGITSTOCOMPARE')) = 
    v8_sys_StripTelephoneNo(:parameter, (select WUSS_VALUE from WUSS where upper(wuss.WUSS_NAME)='TAPINUMBEROFDIGITSTOCOMPARE'))
