Home » SQL & PL/SQL » SQL & PL/SQL » tenure of emp with days and time
tenure of emp with days and time [message #207768] Wed, 06 December 2006 23:53 Go to next message
amit_vass2000
Messages: 52
Registered: December 2006
Location: Delhi
Member
from my table emp i want to get the information of employees. show ename, number of years,number of months, number of days and number of hours with min and sec. I had made a query by which i was able to fetch no. of years and months, Now plz tell me how i could know no. of days and hours with min and sec. Here it is:-

SQL> select ename,trunc(months_between(sysdate,hiredate)/12) YEARS,
2 trunc(mod(months_between(sysdate,hiredate),12)) MONTHS from emp;

ENAME YEARS MONTHS
---------- --------- ---------
ALLEN 25 9
WARD 25 9
JONES 25 8
MARTIN 25 2
BLAKE 25 7
CLARK 25 5
SCOTT 23 11
KING 25 0
TURNER 25 2
ADAMS 23 10
JAMES 25 0
FORD 25 0
MILLER 24 10
ANGELINA 7 6
sujan 26 6
Amit 28 6
Priyanka 21 1
vikas 20 2
KING

19 rows selected.
Re: tenure of emp with days and time [message #207770 is a reply to message #207768] Thu, 07 December 2006 00:04 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Exactly the same question was posted yesterday; there's a link which points to a possible solution. If it doesn't satisfy your needs, search OraFAQ and you'll get the answers.
Re: tenure of emp with days and time [message #207787 is a reply to message #207770] Thu, 07 December 2006 00:55 Go to previous messageGo to next message
amit_vass2000
Messages: 52
Registered: December 2006
Location: Delhi
Member
i have searched but there is only one message that is mine. If u can post it then plz post it. I will be very thankful to you
Re: tenure of emp with days and time [message #207817 is a reply to message #207787] Thu, 07 December 2006 02:26 Go to previous message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Could you, please, post the output you got when you applied Art Metzer's solution to your problem and explain what part of his solution didn't satisfy your needs (except that you should add hours and minutes)?

Also, it seems that you didn't search good enough. Using "age hours" as keywords brought this topic.
Previous Topic: Using UTL file Read selected text from text file
Next Topic: Reference Cursor
Goto Forum:
  


Current Time: Fri Dec 06 23:03:00 CST 2024