GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL Plus
Go To First  |  Previous Question  |  Next Question 
 SQL Plus  |  Question 105 of 132    Print  
What values are stored internally for time (hour,minute ,second) if the date format is dd-mon-yy??

  
Total Answers and Comments: 6 Last Update: May 13, 2008     Asked by: rajani 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 16, 2006 05:56:06   #1  
Mohammed Sajid        

RE: What values are stored internally for time (hour,...

Hello

Date is stored in the Oracle database with different bytes containg century year month day hour minutes and seconds. Date format is only for selecting for a reporting purpose which can be modified as required but date storage can not be modified.

Regards.

Sajid


 
Is this answer useful? Yes | No
June 06, 2006 14:08:28   #2  
rajanipriya Member Since: May 2006   Contribution: 19    

RE: What values are stored internally for time (hour,...

thanks sajid

one more doubt ..can we give sysdate as value for more than one row for a column with a date data type with unique constraint


 
Is this answer useful? Yes | No
September 21, 2006 01:36:30   #3  
Subramani.S        

RE: What values are stored internally for time (hour,...

please explain what command is used to retrieve the date Part its urgent?


 
Is this answer useful? Yes | No
September 25, 2006 01:19:04   #4  
anu_dw Member Since: February 2006   Contribution: 4    

RE: What values are stored internally for time (hour,...

You can use this query

select to_char(sysdate 'dd') from dual;

or

select to_char(sysdate 'dd-mon-yyyy') from dual;

Regards

Anu


 
Is this answer useful? Yes | No
September 26, 2006 14:06:23   #5  
Dharmendra Gohil        

RE: What values are stored internally for time (hour,...

Date Functions:

Oracle stores dates in an internal numeric format:
century year month day hours minutes and seconds

Default display format is DD-MON-YYYY

Oracle stores the year as 1996 & 2002 and not 96 & 00

1. SYSDATE() :
It is a function that returns:
Date.


select sysdate from dual;

2. Calculations on dates:
date + number Date ..adds a no of days to a date
date - number Date ..subtracts a no of days from a date.
date - date No of days ..subtracts one date from another.
date + number/24 Date ..adds a number of hours to a date.

-select dob+1 from one;
-select dob-1 from one;
-select (dob1-dob) from one;

- select dob1-dob from one
no of days between dob1 & dob.

- select (dob1-dob)/7 from one
no of weeks between dob1 & dob.

- select (dob1-dob)/365 from one.
no of years between dob1 & dob.

select first_name hire_date sysdate
'since ' ||round((sysdate-hire_date)/365) ||' years' from employees

3. Date Functions:

-select months_between(dob1 dob) from one
-select dob add_months(dob 3) from one.
-select next_day('20-mar-2003' 1) from one OR
..select next_day('20-mar-2003' 'sun') from one
..returns the next sunday after the specified date.
-select last_day(dob) from one
..returns the last day of the month of the specified date.
-select dob1 round(dob1 'month') from one
..rounds the date to the next month if it is > 15
..rounds the date to the previous month if it is < 15.
e.g. select hire_date round(hire_date 'year') from employees
select hire_date round(hire_date 'day') from employees
..rounds the date to the nearest sunday.

select hire_date round(hire_date 'month') from employees



e.g.
select hire_date add_months(hire_date 3)
(hire_date+90) from employees


 
Is this answer useful? Yes | No
May 08, 2008 08:15:15   #6  
shanthi_9881 Member Since: April 2008   Contribution: 4    

RE: To retrieve the date part of the given date

In sqlserver 2005 we can use as follows to retreive the date part of the given date or sys date
select datepart(dd getdate())


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape