user13541818
user13541818

Reputation:

From keyword is define but I still get error

I am trying to understand this type of error but I couldn't.

ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
*Cause:
*Action:
Error at Line: 1 Column: 9

So far here is my query which I try to execute but I get error. As I see here I have FROM keyword as well as structure are correct If I am right.

SELECT 
    *, 
    (SELECT COUNT(*) 
     FROM project_plans PS1 
     WHERE PS1.Parent = PS.ProjectPlanID) AS children 
FROM 
    project_plans PS  
WHERE 
    PS.Parent = 23 AND PS.ProjectID = 141 
ORDER BY 
    Sort

What is wrong with this query? Where did I make a mistake?

So far I checked this post here:

ORA-00923 From keyword not found where expected

Upvotes: 0

Views: 33

Answers (1)

WaqarAli
WaqarAli

Reputation: 163

You are only missing alias name with * Add that into your query. Order by should have that alias as well It will create problem in future

Modified Query should look like this

SELECT 
    PS.*, 
    (SELECT COUNT(*) 
     FROM project_plans PS1 
     WHERE PS1.Parent = PS.ProjectPlanID) AS children 
FROM 
    project_plans PS  
WHERE 
    PS.Parent = 23 AND PS.ProjectID = 141 
ORDER BY 
    PS.Sort

Upvotes: 1

Related Questions