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
The problem is that your alias has a number in first position; you can quote it or change the alias:
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> select 'a' as 1ABC from dual;
select 'a' as 1ABC from dual
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
SQL> select 'a' as "1ABC" from dual;
1ABC
----
a
A number in a position different from the first gives no problem:
SQL> select 'a' as ABC1 from dual;
ABC1
----
a
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With