• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 106
  • Last Modified:

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
]
0
shieldsco
Asked:
shieldsco
  • 2
2 Solutions
 
QlemoBatchelor, 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
 
QlemoBatchelor, 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now