Problem with To_Date [message #63488] |
Sun, 10 October 2004 05:10 |
Sheila
Messages: 28 Registered: May 1998
|
Junior Member |
|
|
I have a table with the following field:
HS_TASK_ID : Number
HS_DATE :VarChar2
HS_TIME :VarChar2
And I'd like to return the sum of times for a task (HS_TASK_ID) via this query:
SELECT SUM( EXTRACT( HOUR FROM (TO_DATE (HS_TIME , ‘HH24:MI:SS'))) ) INTO TOTAL_HOUR FROM (SELECT * FROM HISTORY WHERE HS_TASK_ID = TASK_ID );
But I'm given the following error message when executing that:
ERROR at line 1:
ORA-30076: invalid extract field for extract source
while it points to To_Date()
Any suggestion will be appreciated.
|
|
|
Re: Problem with To_Date [message #63490 is a reply to message #63488] |
Sun, 10 October 2004 21:31 |
Sujit Sarkar
Messages: 40 Registered: September 2003
|
Member |
|
|
Dear,
do the small changes in your query
SELECT SUM( EXTRACT( HOUR FROM (TO_DATE (TO_CHAR(HS_TIME , ‘HH24:MI:SS'),'HH24:MI:SS')))) INTO TOTAL_HOUR FROM (SELECT * FROM HISTORY WHERE HS_TASK_ID = TASK_ID );
I hope this will work.
best of Luck
Sujit
|
|
|
Re: Problem with To_Date [message #63496 is a reply to message #63490] |
Mon, 11 October 2004 01:20 |
Sheila
Messages: 28 Registered: May 1998
|
Junior Member |
|
|
Thanks for your reply but I'm given this error again:
SELECT SUM( EXTRACT( HOUR FROM (TO_DATE (TO_CHAR(HS_TIME , 'HH24:MI:SS'),'HH24:MI:SS')))) FROM (SELECT * FROM HISTORY WHERE HS_TASK_ID = '2' ) *
ERROR at line 1:
ORA-30076: invalid extract field for extract source
|
|
|