Получаеться след. часть скрипта не выполнилась:
Код:
...
CREATE OR REPLACE VIEW SUPERMAG.MVCARDASSORTMANAGER
(
ARTICLE,
TREE,
PARENT_TREE,
OWNER,
INFO
)
AS
select c.article, d.tree, SUBSTR(d.tree,1,INSTR(d.tree,'.')) parent_tree,
case when (
d.tree like '1.%' or
d.tree like '11.%' or
d.tree like '10.%'
)
then 'Менеджер № 1'
when ((
d.tree like '29.%' or
d.tree like '15.%' or
d.tree like '35.%' or
d.tree like '7.%' or
d.tree like '27.%'
) and (not d.tree like '27.31.1%')
and (not d.tree like '7.8.%')
)
then 'Менеджер № 2'
when ((
d.tree like '8.%' or
d.tree like '50.%' or
d.tree like '3.%' or
d.tree like '41.%' or
d.tree like '12.%'
) and (not d.tree like '12.6.%')
and (not d.tree like '12.7.%')
)
then 'Менеджер № 3'
when (
d.tree like '22.%' or
d.tree like '21.%' or
d.tree like '31.%' or
d.tree like '39.%' or
d.tree like '28.%'
)
then 'Менеджер № 4'
when (
d.tree like '5.%' or
d.tree like '16.%' or
d.tree like '12.6.%' or
d.tree like '12.7.%' or
d.tree like '20.%' or
d.tree like '27.31.1.%' or
d.tree like '44.%' or
d.tree like '47.%'
)
then 'Менеджер № 5'
when (
d.tree like '19.%' or
d.tree like '46.%' or
d.tree like '45.%' or
d.tree like '2.%' or
d.tree like '40.%' or
d.tree like '33.%'
)
then 'Менеджер № 6'
when (
d.tree like '32.%' or
d.tree like '37.%' or
d.tree like '34.%' or
d.tree like '30.%'
)
then 'Менеджер № 7'
when (
d.tree like '4.%' or
d.tree like '7.8.%' or
d.tree like '18.%' or
d.tree like '49.%' or
d.tree like '9.%'
)
then 'Менеджер № 8'
else 'Прочие товары' end owner,
case when (
d.tree like '1.%' or
d.tree like '11.%' or
d.tree like '10.%'
)
then 'Группы 1.,11.,10.'
when ((
d.tree like '29.%' or
d.tree like '15.%' or
d.tree like '35.%' or
d.tree like '7.%' or
d.tree like '27.%'
) and (not d.tree like '27.31.1.%')
and (not d.tree like '7.8.%')
)
then 'Группы 29.,15.,35.,7.,27. кроме 27.31.1. и 7.8.'
when ((
d.tree like '8.%' or
d.tree like '50.%' or
d.tree like '3.%' or
d.tree like '41.%' or
d.tree like '12.%'
) and (not d.tree like '12.6.%')
and (not d.tree like '12.7.%')
)
then 'Группы 8.,50.,3.,41.,12., кроме 12.6. и 12.7'
when (
d.tree like '22.%' or
d.tree like '21.%' or
d.tree like '31.%' or
d.tree like '39.%' or
d.tree like '28.%'
)
then 'Группы 22.,21.,31.,39.,28.'
when (
d.tree like '5.%' or
d.tree like '16.%' or
d.tree like '12.6.%' or
d.tree like '12.7.%' or
d.tree like '20.%' or
d.tree like '27.31.1.%' or
d.tree like '44.%' or
d.tree like '47.%'
)
then 'Группы 5.,16,12.6.,12.7.,20.,27.31.1,44.,47.'
when (
d.tree like '19.%' or
d.tree like '46.%' or
d.tree like '45.%' or
d.tree like '2.%' or
d.tree like '40.%' or
d.tree like '33.%'
)
then 'Группы 19.,46.,45.,2.,40.,33.'
when (
d.tree like '32.%' or
d.tree like '37.%' or
d.tree like '34.%' or
d.tree like '30.%'
)
then 'Группы 32.,37.,34.,30.'
when (
d.tree like '4.%' or
d.tree like '7.8.%' or
d.tree like '18.%' or
d.tree like '49.%' or
d.tree like '9.%'
)
then 'Группы 4.,7.8.,18.,49.,9.'
else 'Прочие группы' end info
from supermag.smcard c,supermag.sacardclass d
where d.id=c.idclass
/
CREATE OR REPLACE VIEW SUPERMAG.MVCARDASSORTMANAGER_TEST
(
ARTICLE,
TREE,
PARENT_TREE,
OWNER,
INFO
)
AS
select c.article, d.tree, SUBSTR(d.tree,1,INSTR(d.tree,'.')) parent_tree,
case when (
d.tree like '1.%' or
d.tree like '11.%' or
d.tree like '10.%'
)
then 'Менеджер № 1'
when ((
d.tree like '29.%' or
d.tree like '15.%' or
d.tree like '35.%' or
d.tree like '7.%' or
d.tree like '27.%'
) and (not d.tree like '27.31.1%')
and (not d.tree like '7.8.%')
)
then 'Менеджер № 2'
when ((
d.tree like '8.%' or
d.tree like '50.%' or
d.tree like '3.%' or
d.tree like '41.%' or
d.tree like '12.%'
) and (not d.tree like '12.6.%')
and (not d.tree like '12.7.%')
)
then 'Менеджер № 3'
when (
d.tree like '22.%' or
d.tree like '21.%' or
d.tree like '31.%' or
d.tree like '39.%' or
d.tree like '28.%'
)
then 'Менеджер № 4'
when (
d.tree like '5.%' or
d.tree like '16.%' or
d.tree like '12.6.%' or
d.tree like '12.7.%' or
d.tree like '20.%' or
d.tree like '27.31.1.%' or
d.tree like '44.%' or
d.tree like '47.%'
)
then 'Менеджер № 5'
when (
d.tree like '19.%' or
d.tree like '46.%' or
d.tree like '45.%' or
d.tree like '2.%' or
d.tree like '40.%' or
d.tree like '33.%'
)
then 'Менеджер № 6'
when (
d.tree like '32.%' or
d.tree like '37.%' or
d.tree like '34.%' or
d.tree like '30.%'
)
then 'Менеджер № 7'
when (
d.tree like '4.%' or
d.tree like '7.8.%' or
d.tree like '18.%' or
d.tree like '49.%' or
d.tree like '9.%'
)
then 'Менеджер № 8'
else 'Прочие товары' end owner,
case when (
d.tree like '1.%' or
d.tree like '11.%' or
d.tree like '10.%'
)
then 'Группы 1.,11.,10.'
when ((
d.tree like '29.%' or
d.tree like '15.%' or
d.tree like '35.%' or
d.tree like '7.%' or
d.tree like '27.%'
) and (not d.tree like '27.31.1.%')
and (not d.tree like '7.8.%')
)
then 'Группы 29.,15.,35.,7.,27. кроме 27.31.1. и 7.8.'
when ((
d.tree like '8.%' or
d.tree like '50.%' or
d.tree like '3.%' or
d.tree like '41.%' or
d.tree like '12.%'
) and (not d.tree like '12.6.%')
and (not d.tree like '12.7.%')
)
then 'Группы 8.,50.,3.,41.,12., кроме 12.6. и 12.7'
when (
d.tree like '22.%' or
d.tree like '21.%' or
d.tree like '31.%' or
d.tree like '39.%' or
d.tree like '28.%'
)
then 'Группы 22.,21.,31.,39.,28.'
when (
d.tree like '5.%' or
d.tree like '16.%' or
d.tree like '12.6.%' or
d.tree like '12.7.%' or
d.tree like '20.%' or
d.tree like '27.31.1.%' or
d.tree like '44.%' or
d.tree like '47.%'
)
then 'Группы 5.,16,12.6.,12.7.,20.,27.31.1,44.,47.'
when (
d.tree like '19.%' or
d.tree like '46.%' or
d.tree like '45.%' or
d.tree like '2.%' or
d.tree like '40.%' or
d.tree like '33.%'
)
then 'Группы 19.,46.,45.,2.,40.,33.'
when (
d.tree like '32.%' or
d.tree like '37.%' or
d.tree like '34.%' or
d.tree like '30.%'
)
then 'Группы 32.,37.,34.,30.'
when (
d.tree like '4.%' or
d.tree like '7.8.%' or
d.tree like '18.%' or
d.tree like '49.%' or
d.tree like '9.%'
)
then 'Группы 4.,7.8.,18.,49.,9.'
else 'Прочие группы' end info
from supermag.smcard c,supermag.sacardclass d
where d.id=c.idclass
/
CREATE OR REPLACE VIEW SUPERMAG.MVCARDCLASSEXTRACHAGE
(
ID,
TREE,
PRICETYPE,
PRICENAME,
EXTRACHARGE
)
AS
select t.id,t.tree,t.pricetype,t.pricename,
nvl(m6.extracharge,nvl(m5.extracharge,nvl(m4.extracharge,nvl(m3.extracharge,nvl(m2.extracharge,nvl(m1.extracharge,m.extracharge)))))) extracharge
from
(
select d.id,
d.tree,
p.id pricetype,
p.name pricename,
0 id_parent,
d1.id id_parent1,
d2.id id_parent2,
d3.id id_parent3,
d4.id id_parent4,
d5.id id_parent5,
d6.id id_parent6
from
SUPERMAG.Svcardtreesplit D,
SUPERMAG.Sacardclass D1,
SUPERMAG.Sacardclass D2,
SUPERMAG.Sacardclass D3,
SUPERMAG.Sacardclass D4,
SUPERMAG.Sacardclass D5,
SUPERMAG.Sacardclass D6,
SUPERMAG.SMPRICETYPES P
where
d1.tree(+)=nvl(d.Item1,'#') and
d2.tree(+)=nvl(d.Item1,'#')||nvl(d.Item2,'#') and
d3.tree(+)=nvl(d.Item1,'#')||nvl(d.Item2,'#')||nvl(d.Item3,'#') and
d4.tree(+)=nvl(d.Item1,'#')||nvl(d.Item2,'#')||nvl(d.Item3,'#')||nvl(d.Item4,'#') and
d5.tree(+)=nvl(d.Item1,'#')||nvl(d.Item2,'#')||nvl(d.Item3,'#')||nvl(d.Item4,'#')||nvl(d.Item5,'#') and
d6.tree(+)=nvl(d.Item1,'#')||nvl(d.Item2,'#')||nvl(d.Item3,'#')||nvl(d.Item4,'#')||nvl(d.Item5,'#')||nvl(d.Item6,'#')
) T,
SUPERMAG.SMMARKUPCLASS M6,
SUPERMAG.SMMARKUPCLASS M5,
SUPERMAG.SMMARKUPCLASS M4,
SUPERMAG.SMMARKUPCLASS M3,
SUPERMAG.SMMARKUPCLASS M2,
SUPERMAG.SMMARKUPCLASS M1,
SUPERMAG.SMMARKUPCLASS M
where
(m6.pricetype(+)=T.pricetype and m6.idclass(+)=T.id_parent6) and
(m5.pricetype(+)=T.pricetype and m5.idclass(+)=T.id_parent5) and
(m4.pricetype(+)=T.pricetype and m4.idclass(+)=T.id_parent4) and
(m3.pricetype(+)=T.pricetype and m3.idclass(+)=T.id_parent3) and
(m2.pricetype(+)=T.pricetype and m2.idclass(+)=T.id_parent2) and
(m1.pricetype(+)=T.pricetype and m1.idclass(+)=T.id_parent1) and
(m.pricetype=T.pricetype and m.idclass=T.id_parent) and not m.extracharge is null
/
Возможно, что эти вьюхи нужно создавать под другим пользователем, нежели под пользователем SYSTEM?