We help IT Professionals succeed at work.

Missing Right Parenthesis Oracle SQL

1,138 Views
Last Modified: 2014-11-22
I am getting an error "Missing Right Parenthesis"  on this line.        ) C ON A.PLAN_ID=C.PLAN_ID AND A.SSN_ID=C.SSN_ID  

 I can't figure why - it looks like all of them are there.


____________________________________________________________________________________________


SELECT PLAN_N, PLAN_SHRT_NM, DVSN_NM, C.Plan_ID,
   SUM(Case when BAL>0 THEN Balance Else 0 end) as "Assets"
        FROM(
      SELECT A.PLAN_ID, PLAN_N, PLAN_SHRT_NM, SUM(END_ASET_BAL_A)as BAL
      FROM dbo.V_BAL_MO A      
         
          LEFT JOIN(
                SELECT
               (Sum(case when STAT_C IN ('A') AND PCNT > 1 and DEF_DOL = 0 then 1 else 0 end)
               +Sum(case when STAT_C IN('A') AND PCNT < 1 and DEF_DOL > 0
               then 1 else 0 end))/Sum(case when STAT_C IN('A')
               then 1 else 0 end) as RATE
                ,NVL(ROUND(AVG(CASE when STAT_C IN ('A')
                AND PCNT > 1 THEN PCNT end),2),0) as DRATE
          FROM(
             SELECT PlanID, NVL(DEF_A,0) as DEF_DOL, NVL(DEF_P,0) as PCNT, SSN_ID, STAT_C
             FROM dbo.V_PART
             WHERE row_exp_d=TO_DATE('01/01/9999','MM/DD/YYYY')
             AND PLAN_ID IN ('207')
             ) C ON A.PLAN_ID=C.PLAN_ID AND A.SSN_ID=C.SSN_ID  

) GROUP BY PLAN_N, PLAN_SHRT_NM, DVSN_NM
Comment
Watch Question

Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I get other errors adding more parenthesis.
Racim BOUDJAKDJIDatabase Architect - Dba - Data Scientist
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Mark GeerlingsDatabase Administrator
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I did not write the code and may post the complete code to get help.  I am not a SQL guru and can use all the help I can get.  The code can probably be rewritten to be more efficient.
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I appreciate comments.
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Oracle SQL
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
>>Oracle SQL

I do not know what this is trying to tell me.

Author

Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for leezac's comment #a40448694
Assisted answer: 84 points for Jim Horn's comment #a40443436
Assisted answer: 84 points for Racimo's comment #a40443604
Assisted answer: 83 points for slightwv's comment #a40443632
Assisted answer: 83 points for markgeer's comment #a40443703
Assisted answer: 83 points for slightwv's comment #a40443858
Assisted answer: 83 points for slightwv's comment #a40448635

for the following reason:

Thank you!

Author

Commented:
Thank you!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.