В отдел гипотетической отчетности нужны тысячи отчетов каждый день.Правильный ли это подход - создание одного отчета для каждого представления в базе данных Oracle 11g?Есть ли у Oracle 11g какие-либо ограничения на создание представлений в базе данных?
Пример кода представления приведен ниже.
CREATE VIEW Report1DXC AS
select Phonenumber,DECODE(package, 'Package1', 'Package Normal',
'Package2', 'Package Normal',
'Package3', 'Package Premium',
'Package4', 'Package Premium',
'Package5', 'Package Normal',
'Package6', 'Package Normal',
'Package7', 'Package Premium',
'Package8', 'Package Premium',
'Package9', 'Package Normal',
'Package10', 'Package Premium',
'Package11', 'Package Premium',
'Package12', 'Package Premium') package,renewid,Sub_End_date from (
SELECT DISTINCT subs_id, ContractNo, phonenumber as Phonenumber,
Package, renewid, Sub_End_date,function_mobnum_format(phonenumber) ph_correct
FROM
subscription_history rh
INNER JOIN sub_equipment se ON rh.subs_id = se.subs_id AND rh.contractno = se.contractno
INNER JOIN packages pk ON rh.pkid = pk.pkid
INNER JOIN sub_phones ph ON rh.subs_id = ph.subs_id and rh.contractno=ph.contractno
INNER JOIN
(SELECT subs_id, contractno, MAX(sub_end_date) AS sub_end_date FROM subscription_history where currentid=sequenceid GROUP BY subs_id, contractno) lr
ON rh.subs_id = lr.subs_id AND rh.contractno = lr.contractno
WHERE rh.currentid=rh.sequenceid
and emodel LIKE 'DXN%'
and rh.origin='R'
and rh.pcode=09
and rh.cancellation is null
AND TRUNC(lr.sub_end_date) > '29-JAN-18'
AND TRUNC(lr.sub_end_date-5) = TRUNC(SYSDATE)
AND rh.subs_id not in (select subs_id from subscription_history where TRUNC(sub_end_date-5) > TRUNC(SYSDATE))
and rh.subs_id not in (select subs_id from subscription_history where pkid IN ('PKID10','PKID11'))
ORDER BY rh.subs_id
)where ph_correct='OK';