вот запрос:
WITH GOODS AS (SELECT TT.N_USER_ID,
TT.VC_CODE,
TT.N_GOOD_ID,
TT.N_PRICE_DOC_ID,
TT.VC_PRICE_DOC
FROM SI_V_USER_GOODS UG,
TABLE(SI_USERS_PKG_S.USER_AVAILABLE_SERVS_LIST(
num_N_CONTRACT_ID => UG.N_DOC_ID,
num_N_ACCOUNT_ID => UG.N_ACCOUNT_ID,
num_N_OBJECT_ID => UG.N_OBJECT_ID,
dt_D_OPER => SYSDATE)) TT
WHERE UG.C_FL_CLOSED = 'N'
AND UG.N_SUBJ_GOOD_TYPE_ID != SYS_CONTEXT('CONST', 'GOOD_SUBJ_Enable')
),
PRICE AS (SELECT DISTINCT G.N_GOOD_ID,
G.N_USER_ID,
G.VC_CODE,
G.VC_PRICE_DOC,
DC.N_PRICE,
INDC.N_SPEED_VOLUME IN_SPEED,
INDC.N_SPEED_UNIT_ID IN_VALUE_SPEED,
OUTDC.N_SPEED_VOLUME OUT_SPEED,
OUTDC.N_SPEED_UNIT_ID OUT_VALUE_SPEED
FROM GOODS G,
SD_V_PRICE_ORDERS_C DC,
SD_V_PRICE_ORDERS_C INDC,
SD_V_PRICE_ORDERS_C OUTDC
WHERE G.N_PRICE_DOC_ID = DC.N_DOC_ID
AND G.N_GOOD_ID = DC.N_GOOD_ID
AND DC.N_PRICE_ORDER_LINE_ID = INDC.N_PAR_LINE_ID (+)
AND DC.N_PRICE_ORDER_LINE_ID = OUTDC.N_PAR_LINE_ID (+)
AND INDC.N_GOOD_ID (+) = 40213701
AND OUTDC.N_GOOD_ID (+) = 40213501)
SELECT SI_SUBJECTS_PKG_S.GET_VC_CODE(N_USER_ID) VC_SUBJ,
VC_CODE,
VC_PRICE_DOC,
N_PRICE,
IN_SPEED,
CASE IN_VALUE_SPEED
WHEN 2050 THEN 'Мбит/с'
WHEN 1050 THEN 'Кбит/с'
WHEN 3050 THEN 'бит/с'
END IN_VALUE_SPEED,
OUT_SPEED,
CASE OUT_VALUE_SPEED
WHEN 2050 THEN 'Мбит/с'
WHEN 1050 THEN 'Кбит/с'
WHEN 3050 THEN 'бит/с'
END OUT_VALUE_SPEED
FROM PRICE;