Здравствуйте)
При запуске запроса
with rec(pr.pid,cid,par_cid,name,incoming,outcoming,balance) as (
select
pr.pid,
null as cid,
pr.rcid as par_cid,
pr.pname as name,
sum(case when incoming = '1' then rec.quantity end) incoming,
sum(case when incoming = '0' then rec.quantity end) outcoming,
sum(case when incoming = '1' then 1 else -1 end * rec.quantity) balance
from
products pr
inner join records rec on rec.rpid=pr.pid
group by
pr.pid,
pr.rcid,
pr.pname
union all select
null,
cat.cid,
cat.par_cid,
cat.rname,
incoming,
outcoming,
balance
from
rec
inner join catalog cat on cat.cid = rec.par_cid)
select
pid,
cid,
name,
sum(incoming),
sum(outcoming),
sum(balance)
from
rec
group by
pid,
cid,
name;
Oracle пишет ошибку: "ORA-02000: missing ) keyword". Подскажите, что неправильно?