"ORA-00923: FROM keyword not found where expected" Encountered in my oracle query

15.5k Views Asked by At
      SELECT TITLE, CONCAT(TO_CHAR(SUM((COST-RETAIL)/COST)*100), '100'), '%') 
      AS "Markup"
      FROM BOOKS
      GROUP BY TITLE; 

::THE GOAL::
I'm trying to calculate the mark-up for my products (books).

::ZE PROBLEM::
When I try to run the stated SQL, I get the error

ORA-00923: FROM keyword not found where expected

In advance I thank you for any and all input on my issue.

3

There are 3 best solutions below

0
munch1324 On

Your parentheses are not balanced I count 4 left and 5 right. This error usually happens when there is a formatting error that prevents the FROM clause from being reached (missing/extra comma, unbalanced bracket, etc)

1
Randy On
  SELECT TITLE, TO_CHAR( SUM( COST-RETAIL )/ SUM( COST )) || '%'
      AS "Markup"
      FROM BOOKS
      GROUP BY TITLE; 
2
Joe W On

There was an extra right parentheses and here is what it should look like.

SELECT TITLE, CONCAT(TO_CHAR(SUM((COST-RETAIL/COST)*100), '100'), '%') 
AS "Markup"
FROM BOOKS
GROUP BY TITLE;