Seems like you executed the first two queries in different sessions as they return inconsistent results.
Anyway, the case is clear: both DATETIME and TRUNC( DATETIME, 'HH24' ) have DATE data type. For displaying them, Oracle converts it to string using NLS_DATE_FORMAT parameter.
To display the DATE in required format, either change the value of NLS_DATE_FORMAT in the session where you run the query, or
Quote:
|
Originally Posted by flyboy
(if the query is used only for displaying purpose) return result with VARCHAR2 data type.
|
using TO_DATE function with required format mask.