Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Incorrect syntax near ')' error

Johnbr (Oracle10G)Feb 26 2013 — edited Feb 26 2013
Hi,

I can run the sub querey in this fine, but when I apply Select * around it, I get the Incorrect syntax near ')' error.

What am I doing wrong?
SELECT * 
  
 FROM
 (       
        SELECT 
        /* CFEs Remaining in QUE by Department*/
          "TBL_APPROVAL"."Type",
         /* When statement to isolate approved value. Compare to report.*/
         Case
                WHEN "TBL_APPROVAL"."Approved" = 2
                THEN 'Approved'       
                WHEN "TBL_APPROVAL"."Approved" = -1
                THEN 'Disapproved'       
                Else 'Pending'      
         End as 'Approved',
        
          Cast("TBL_CATEGORIES"."Name" as varchar) as 'Name',
          Cast("tb_employees2"."FirstName" as varchar) as 'FirstName',
          Cast("tb_employees2"."LastName" as varchar) as 'LastName',
          Cast("tb_employees2"."DepartmentName" as varchar) as 'DepartmentName',
          "TBL_MAIN"."AuthoredDate",
          Cast ("TBL_MAIN"."PK_CFEID" as int) as 'PK CFEID',
          Convert(Varchar(max),"TBL_MAIN"."Title") as 'Title'
          
        FROM
          (("Insite_TeamShare"."dbo"."TBL_MAIN" "TBL_MAIN"
        LEFT OUTER JOIN
          "Insite_TeamShare"."dbo"."TBL_CATEGORIES" "TBL_CATEGORIES"
        ON
          "TBL_MAIN"."FK_CategoryID"="TBL_CATEGORIES"."PK_CategoryID")
        LEFT OUTER JOIN
          "Insite_EmployeeContact"."dbo"."tb_employees2" "tb_employees2"
        ON
          "TBL_MAIN"."AuthorID"="tb_employees2"."EmpNumber")
        LEFT OUTER JOIN
          "Insite_TeamShare"."dbo"."TBL_APPROVAL" "TBL_APPROVAL"
        ON
          "TBL_MAIN"."PK_CFEID"="TBL_APPROVAL"."FK_CFEID"
        WHERE
          "tb_employees2"."DepartmentName" = 'Information Technology'
        
 )
 
 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 26 2013
Added on Feb 26 2013
5 comments
1,230 views