ORA-00923: FROM keyword not found where expected

While specifying date with a function, syntax error is thrown due to missing quotes

SQL> select to_char(BEGIN_TIME,'dd-mm-yy hh24:mi:ss') start,to_char(END_TIME,'dd-mm-yy hh24:mi:ss') end from v$undostat;
select to_char(BEGIN_TIME,'dd-mm-yy hh24:mi:ss') start,to_char(END_TIME,'dd-mm-yy hh24:mi:ss') end from v$undostat
                                                 *
ERROR at line 1:
ORA-00923: FROM keyword not found where expected

Use quotes while specifying alias for a function

SQL> select to_char(BEGIN_TIME,'dd-mm-yy hh24:mi:ss') "start",to_char(END_TIME,'dd-mm-yy hh24:mi:ss') "end" from v$undostat;

start             end
----------------- -----------------
16-08-21 23:35:46 16-08-21 23:45:39
16-08-21 23:25:46 16-08-21 23:35:46

Leave a Reply