java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected

I getting the following error message when trying to execute the code below on line - 'Case When ALJ.C_Team_Name IS Null THEN "Unspecified" ELSE ALJ.C_Team_Name' End AS "Adjudicator Login"


java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected


[Select
 A.C_ALJ_APPEAL_NUM AS "Appeal Number"
,A.C_RECONSIDER_NUM AS "Level 2 Appeal Number"
,Case When DT.C_NAME IS NULL Then W.C_NAME Else W.C_NAME ||'  '||'('|| DT.C_NAME ||')' END AS "Appeal Status"
,TO_CHAR(coalesce(A.C_COMPLETE_REQUEST_RECVD_DT,A.C_REQUEST_RECV_DT), 'MM-DD-YYYY') as "Dt Comp Rqst Recd"
,' ' as "Begin Hearing Date"
,TO_CHAR (A.C_DLM_DATE, 'MM-DD-YYYY')  AS "Dec Ltr Mailed"
,' ' as "New Appeal Number"



'Case When ALJ.C_Team_Name IS Null THEN "Unspecified" ELSE ALJ.C_Team_Name' End AS "Adjudicator Login"

From
(
(T_APL A inner join T_RF_STATE W on A.C_WORKFLOW_STATE = W.ID)
left outer join  T_ALJ ALJ on  ALJ.ID = A.C_ALJ_TEAM
left outer join T_APPEAL_DECISION_WRITING ADW on A.id = ADW.ID_PARENT)
left outer join T_DECISION_TYPE DT on adw.C_DECISION_TYPE = DT.ID
WHERE
A.C_WORKFLOW_STATE not in (136,140,139,143,137,138,130,144)
order by A.C_ALJ_TEAM
]
shieldscoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
There are several issues with that line. Corret is
, Case When ALJ.C_Team_Name IS Null THEN 'Unspecified' ELSE ALJ.C_Team_Name' End AS "Adjudicator Login"

Open in new window

0
Pawan KumarDatabase ExpertCommented:
In the last command other expert missed a single quote after ALJ.C_Team_Name in the else part. So that will give the syntax error.

@Author - we need to specify the comma between fields in SQL query. If we are passing hardcoded strings then that has to be in singlequotes (e.g. 'Unspecified' ) , columnNames are not to be in the singlequotes otherwise they will be considered as hardcoded strings.

Please use this and let us know in case of any issues.

Select
 A.C_ALJ_APPEAL_NUM AS "Appeal Number"
,A.C_RECONSIDER_NUM AS "Level 2 Appeal Number"
,Case When DT.C_NAME IS NULL Then W.C_NAME Else W.C_NAME ||'  '||'('|| DT.C_NAME ||')' END AS "Appeal Status"
,TO_CHAR(coalesce(A.C_COMPLETE_REQUEST_RECVD_DT,A.C_REQUEST_RECV_DT), 'MM-DD-YYYY') as "Dt Comp Rqst Recd"
,' ' as "Begin Hearing Date"
,TO_CHAR (A.C_DLM_DATE, 'MM-DD-YYYY')  AS "Dec Ltr Mailed"
,' ' as "New Appeal Number"
,Case When ALJ.C_Team_Name IS Null THEN 'Unspecified' ELSE ALJ.C_Team_Name End AS "Adjudicator Login"
From 
(
(T_APL A inner join T_RF_STATE W on A.C_WORKFLOW_STATE = W.ID) 
left outer join  T_ALJ ALJ on  ALJ.ID = A.C_ALJ_TEAM
left outer join T_APPEAL_DECISION_WRITING ADW on A.id = ADW.ID_PARENT)
left outer join T_DECISION_TYPE DT on adw.C_DECISION_TYPE = DT.ID
WHERE
A.C_WORKFLOW_STATE not in (136,140,139,143,137,138,130,144) 
order by A.C_ALJ_TEAM 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
That's true, I forgot to remove the single quote when pasting back here :-(.
1
shieldscoAuthor Commented:
Thanks Pawan
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.