Oracle’s default date format is YYYY-MM-DD. Which means if I do:
select some_date from some_table
…I lose the time portion of my date.
Yes, I know you can “fix” this with:
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
But seriously, why isn’t the above the default? Especially in a DBMS where the two primary time-tracking data types (DATE and TIMESTAMP) both have a time component that includes (at least) accuracy down to 1 second.
If you are using this query to generate an input file for your Data Warehouse, then you need to format the data appropriately. Essentially in that case you are converting the date (which does have a time component) to a string. You need to explicitly format your string or change your nls_date_format to set the default. In your query you could simply do: