Reputation: 49
I have taken only the time value from systimestamp. But with the same i need to extract hour from time value.
SELECT EXTRACT (HOUR FROM TO_CHAR(systimestamp,'hh24:mi:ss'')) FROM DUAL ;
but I'm getting "invalid extract field for extract source"
Upvotes: 0
Views: 2971
Reputation: 35900
You can also use to_char
as follows:
SELECT to_char(systimestamp,'hh24') FROM DUAL
Upvotes: 2
Reputation: 43
It looks like you're converting your timestamp to a character, which means it doesn't have an hour value for you to extract.
Try taking systimestamp out of the function.
SELECT EXTRACT(HOUR FROM systimestamp) FROM DUAL;
Upvotes: 3