Search code examples
sqloraclereport

Query fails with 'ORA-00923: FROM keyword not found where expected'


select pl.label_id,
( select pv.label_value 
from PV_I18N_ACTIVE_LOCALE_LABEL pv 
where pv.locale_id='English' 
and pv.label_type_id = 'LABEL'
and pv.label_id = pl.label_id ) as 'English',
( select pv.label_value 
from PV_I18N_ACTIVE_LOCALE_LABEL pv 
where pv.locale_id='Hindi' 
and pv.label_type_id = 'LABEL'
and pv.label_id = pl.label_id ) as 'Hindi',

from PV_I18N_ACTIVE_LOCALE_LABEL pl
where pl.label_type_id = 'LABEL'
order by pl.label_id

The error is

ORA-00923: FROM keyword not found where expected

Solution

  • You have extra , in your SQL, which is just before FROM keyword.

    and pv.label_id = pl.label_id ) as 'Hindi',
    
    from PV_I18N_ACTIVE_LOCALE_LABEL pl
    

    ==Edited==

    I'm not sure, why are you making query so complex, when it can be done easily. Why are you using inline query, when same thing you can achieve by using CASE statement.

    select CASE WHEN pl.locale_id='English' THEN 
    pl.label_value 
    END  as 'English',
    CASE WHEN pl.locale_id='Hindi' THEN 
    pl.label_value 
    END  as 'Hindi'  from PV_I18N_ACTIVE_LOCALE_LABEL pl where pl.label_type_id = 'LABEL';