troubleshooting Question

ORA-22818: subquery expressions not allowed here - Group BY

Avatar of xbox360dp
xbox360dp asked on
Oracle Database
11 Comments1 Solution2967 ViewsLast Modified:
Gurus,

How do I get around the fact that I can't add a subquery to my group by clause and get the result I need?

SELECT kat.katkeyi,
  vgb.vgbbezc ,
  dok.dokkeyi,
  abp.abpbezc,
  dok.dokinfc,
  NVL (zplbezc, 'No TimePlan'),
  DOK.DOKOWNC,
  stragg (dok.doknlc),
(SELECT AFL.AFLFLDC
  FROM AFL
  INNER JOIN FTY
  ON AFL.AFLFTYKEYI  = FTY.FTYKEYI
  WHERE FTY.FTYBEZC  = 'LTtableID'
  AND AFL.AFLARTKEYI = ART.ARTKEYI
  AND AFL.AFLKAVKEYI = ART.ARTKAVKEYI
  ) AS lttableid
FROM kat, dok, vgb, abp, zpl
WHERE zpl.zplabpkeyi(+) = abp.abpkeyi
AND kat.katvgbkeyi      = vgb.vgbkeyi
AND dok.dokkatkeyi      = kat.katkeyi
GROUP BY kat.katkeyi, vgb.vgbbezc, dok.dokkeyi, abp.abpbezc, dok.dokinfc, zpl.zplbezc, DOK.DOKOWNC,
  (SELECT AFL.AFLFLDC
  FROM AFL
  INNER JOIN FTY
  ON AFL.AFLFTYKEYI  = FTY.FTYKEYI
  WHERE FTY.FTYBEZC  = 'LTtableID'
  AND AFL.AFLARTKEYI = ART.ARTKEYI
  AND AFL.AFLKAVKEYI = ART.ARTKAVKEYI);

ORA-22818: subquery expressions not allowed here
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros