nad nad - 2 months ago 9
SQL Question

Oracle merging column is giving error

I have 2 columns in oracle, that I am merging like below

select SURVEY_AREA_7_12 || ' ' || HISSA_NO_7_12
from XXCUS.XXACL_PN_FARMING_MST


which is working fine. But when I add my own name to the columns like below

select SURVEY_AREA_7_12 || ' ' || HISSA_NO_7_12 as 712_Column
from XXCUS.XXACL_PN_FARMING_MST


it gives error as


ORA-00923: FROM keyword not found where expected

Answer

712_Column is an invalid SQL identifier. You can't start an identifier with a number. If you need this, you need to quote the name:

select SURVEY_AREA_7_12 || ' ' || HISSA_NO_7_12 as "712_Column"
from XXCUS.XXACL_PN_FARMING_MST