Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6755605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:25:24+00:00 2026-05-26T13:25:24+00:00

Can someone can tell me a nice approach to checking how, and where, parenthesis

  • 0

Can someone can tell me a nice approach to checking how, and where, parenthesis may be missing (or be in excess) in a query such as the following?

For example, this query returns error that it is missing right parenthesis. But where??? !

SELECT * FROM ( SELECT X.*, ROWNUM AS RN FROM (SELECT ORG_UNIT, QUEUE_NAME, CASE_STATUS, AGENT_ROLE, COUNT(*) AS CASE_COUNT 
   FROM 
   (    
     SELECT ORG_UNIT, QUEUE_NAME, CREATION_TIMESTAMP, CASE_STATUS, AGENT_ROLE
     FROM 
     (   SELECT OU.NAME AS ORG_UNIT,            D.NAME AS QUEUE_NAME, 
                WS.NAME AS CASE_STATUS,  C.ASSIGNED_TO AS AGENT_ID,  C.CREATION_TIMESTAMP AS CREATION_TIMESTAMP,
                CASE NVL(C.ASSIGNED_TO, -1) WHEN -1 THEN 'Unassigned' ELSE RU.ROLE_NAME END AS AGENT_ROLE 
           FROM CASES C 
           JOIN ORGANIZATION_UNITS OU ON OU.ID = C.ORGUNIT_ID       
           JOIN WORKFLOW_STATUSES WS ON WS.ID = C.STATUS_ID 
           JOIN DOMAINS D ON D.ID = C.DOMAIN_ID 
           JOIN DOMAINS DP ON DP.ID = D.PARENT_ID
LEFT OUTER JOIN (SELECT DISTINCT C.ASSIGNED_TO AS AGENT_ID, RL.NAME AS ROLE_NAME 
                                  FROM CASES C 
                                    JOIN DOMAINS D ON D.ID = C.DOMAIN_ID 
                                    JOIN DOMAINS DP ON DP.ID = D.PARENT_ID 
                                    JOIN USER_GROUP_RELATIONS UGR ON UGR.USER_ID = C.ASSIGNED_TO 
                                    JOIN GRP_ORG_DOM_ROLE_RELATIONS GODRR ON (GODRR.GROUP_ID = (SELECT MAX(UGR.GROUP_ID) 
                                                                                                                                                                   FROM USER_GROUP_RELATIONS UGR 
                                                                                                                                                                 WHERE   UGR.USER_ID = C.ASSIGNED_TO) 
                                                                                                                   AND GODRR.DOMAIN_ID =C.DOMAIN_ID
                                                                                                                   AND GODRR.ORGANIZATION_ID = C.ORGUNIT_ID) 
  JOIN ROLES RL ON RL.ID = (SELECT MAX(GODRR.ROLE_ID) 
                                                  FROM GRP_ORG_DOM_ROLE_RELATIONS GODRR 
                                                WHERE GODRR.GROUP_ID = UGR.GROUP_ID 
                                                     AND GODRR.ORGANIZATION_ID = C.ORGUNIT_ID AND GODRR.DOMAIN_ID = C.DOMAIN_ID)            
                                WHERE DP.NAME='DD') RU ON RU.AGENT_ID = C.ASSIGNED_TO 
       WHERE DP.NAME='DD' 
     )  WHERE 1=1
   ) 
   GROUP BY ORG_UNIT, QUEUE_NAME, CASE_STATUS, AGENT_ROLE  
   ORDER BY ORG_UNIT, QUEUE_NAME, CASE_STATUS, AGENT_ROLE order by ORG_UNIT asc ) X ) WHERE RN > 0 AND RN <= 10
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:25:25+00:00Added an answer on May 26, 2026 at 1:25 pm

    Crimson Edit and many other text editors and IDEs have brace matching.

    http://en.wikipedia.org/wiki/Crimson_Editor

    If brace match, but are nested wrong, you may need to change your indentation strategy.

    Also, code formatting tools sometimes can make it clear where you missed a paren or nested wrong.

    Here is one online place where you can paste in your code to see it reformatted.

    http://www.dpriver.com/pp/sqlformat.htm

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone tell me why this processes all the files and then does it
Can someone tell me why this http://hupcapstudios.com/projects/calendar.html won't load in IE? The error message:
Can someone tell me how to accomplish this mapping using Fluent NHibernate? It's simply
Can someone tell me why the following does not match: >>> re.search(r'(\d{2, 10})', '153')
Can someone tell me why this is not working: <button class=btn danger id=delete onclick=return
Can someone tell me what's wrong with this http://jsfiddle.net/Yp8Bz/ ? It works fine in
Can someone tell me why this is not working right? I have these lines
Can someone tell me how to add easing to this plugin. I understand there's
Can someone tell me, when you for example update, insert, delete.. should you then
Can someone tell me whats going wrong in this code! testit :- read(Term1), read(Term2),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.