When I try to provide a default for a timestamp value in the XMLTABLE function, I am greeted with an error - ORA-01843: not a valid month - no matter how I provide that default value. Whether there is a value present in the XML or not is irrelavant for this bug to occur. It appears to be an incomplete fix of bug number 9745897 (thread).
select x.*
from
xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
COLUMNS dt timestamp default sysdate) x;
select x.*
from
xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
COLUMNS dt timestamp default systimestamp) x;
select x.*
from
xmltable('/DOC' passing xmltype('<DOC><DT>2013-08-14T15:08:31</DT></DOC>')
COLUMNS dt timestamp default to_char(systimestamp, 'YYYY-MM-DD"T"HH24:MI:SS') ) x;
Edit: A little more followup.
This works:
select x.*
from
xmltable('/DOC' passing xmltype('<DOC></DOC>')
COLUMNS dt date default sysdate) x;
This also works, except for its just the date, and not the date/time
select x.*
from
xmltable('/DOC' passing xmltype('<DOC></DOC>')
COLUMNS dt timestamp default sysdate) x;
This doesn't work
select x.*
from
xmltable('/DOC' passing xmltype('<DOC></DOC>')
COLUMNS dt timestamp default systimestamp) x;
ORA-01861: literal does not match format string