SELECT T1.ROW_ID "RowId",
T1.ASSET_NUM "AssetNum",
T1.STATUS_CD "Status",
(SELECT T2.VAL
FROM SIEBEL.S_LST_OF_VAL T2
WHERE T1.STATUS_CD = T2.NAME
AND T2.ACTIVE_FLG = 'Y'
AND T2.TYPE = 'IMPL_PHASE'
AND T2.LANG_ID = 'CHS') "StatusVal",
NVL(TO_CHAR(ROUND(T1.ASSET_VALUE_AMT, 3), 'FM9,999,999,999,999,990.00'), '0.00') "money",
NVL(TO_CHAR(ROUND(T1.AVAIL_BAL, 3), 'FM9,999,999,999,999,990.00'), '0.00') "account",
NVL(TO_CHAR(ROUND(T1.REVENUE, 3), 'FM9,999,999,999,999,990.000'), '0.000') "applySum",
T1.LOT_NUM "relativeSerialNo"
FROM SIEBEL.S_ASSET T1
WHERE NOT EXISTS (SELECT T3.ATTRIB_01
FROM SIEBEL.S_REVN_XM T3
WHERE T1.ASSET_NUM = T3.ATTRIB_01)
--AND T1.PROD_ID = #ProductId#
-- AND T1.X_LOGINID = #LoginName#
-- AND T1.X_ORG_NUMBER = #orgNumber#