On the sqlplus command line, if your system supports the NLS setting:
select TO_DATE(' 2015-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN') from dual;
The value of that field is the whole statement:
TO_DATE(' 2015-05-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
I assume you want the actual date to print:
DECLARE
foo varchar2(20):=NULL;
BEGIN
select my_field
into foo
from my_table;
execute immediate my_field;
END;
/
Tis is very cunbersome - what you really want is just the date string. But. This is what you asked for I think.
Something like this:
select substr(myfield, 10, 9) from my_table;
This is my take on it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…