Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to execute EXTRACT( HOUR.. in version 10.2.0.1.0 ?

602857Jan 21 2009 — edited Jan 22 2009
Hi colleagues!!

I am using the oracle version 10.2.0.1.0 and I found that there is a function called EXTRACT

This function works good when I execute the year, month and day, but in minute, second and hour doesn't work. This display the error
ORA-30076: invalid extract field for extract source.

Is neccesary make execute some query to be available this function in this version?

SELECT EXTRACT( HOUR FROM DATE_VARIABLE ) FROM DUAL;

For questions of performance I don't want to use TO_CHAR function. Is it right?

SELECT TO_CHAR( DATE_VARIABLE, 'HH' ) FROM DUAL;

I think is better the function EXTRACT because it returns number and the TO_CHAR function returns a VARCHAR


Any Help will be very appreciated
Thanks in advance
Best Regards
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 19 2009
Added on Jan 21 2009
4 comments
15,253 views