Toad World® Forums

Error:Right parenthesis not found. How to resolve it ?

“(SELECT e.siebleloginid, e.lastname || ', ’ || e.firstname AS employee,”+

“AS tierlevel FROM emadministration.tblemployeeinfo m, emadministration.tblemployeeinfo e,”+

“z.usernameman = m.username AND e.section = z.section AND e.employmentstatus = ‘Active’)”+

"DECODE (e.siebleloginid, m.siebleloginid, 1, 0 ) AS tierlevel FROM "+

“emadministration.tblzlistsectsup z WHERE m.siebleloginid =‘OLEMSUP’”+

“AND z.tempsupenddate >= TRUNC (SYSDATE - 0.25)))”+

“UNION (SELECT e.siebleloginid, e.lastname || ', ’ || e.firstname AS employee,”+

“FROM emadministration.tblemployeeinfo e, emadministration.tblzlistsectsup zm,”+

“e.employmentstatus = 'Active’AND e.username = zm.usernameman(+) AND”+

“ORDER BY tier DESC, employee”;

string str3 = “SELECT a.siebleloginid, a.employee, MAX (a.tierlevel) AS tier FROM”+ “DECODE (e.siebleloginid, m.siebleloginid, 2, DECODE (e.username, z.usernamesup, 1, 0) )”+“emadministration.tblzlistsectsup z WHERE m.siebleloginid =‘OLEMSUP’ AND”+"UNION (SELECT e.siebleloginid, e.lastname || ', ’ || e.firstname AS employee, "+“emadministration.tblemployeeinfo m, emadministration.tblemployeeinfo e,”+"AND (z.usernamesup = m.username OR (z.usernametempsup = m.username "+"AND e.section = z.section AND e.employmentstatus = ‘Active’) "+“DECODE (zm.usernameman, NULL, DECODE (zs.usernamesup, NULL, 0, 1),2) AS tierlevel”+ “emadministration.tblzlistsectsup zs WHERE e.siebleloginid =‘OLEMSUP’ AND”+“e.username = zs.usernamesup(+)) a GROUP BY a.siebleloginid, a.employee”+

Curious to know if you used TDA to format that code as a string. The first thing I would suggest is to “undo” the formatting so you can work with just the SQL syntax. If you format the code, you might have an easier time locating the missing parenthesis.

In the editor, if you click just to the left or right of any parenthesis, the editor will highlight the matching parenthesis; as shown in the attached screenshot.

Well, I copied this text into a text editor and looked it over. There are 14 left parens and 14 right parens. What makes you think the parenthesis are unbalanced?