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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s