Sysdate with time interval parameter [message #638571] |
Mon, 15 June 2015 08:47 |
|
RADHAKAN
Messages: 7 Registered: May 2015
|
Junior Member |
|
|
HI,
I am new to SQL, can anyone help me in giving the sysdate parameter with time interval.
I have script which i want to run so that it would give the data processed within a time frame on a daily basis.
For example i need report with sysdate -2 06:30:00 PM to sysdate -1 06:30:00 PM.
And can i replace the sysdate with actual date.
Regards,
|
|
|
|
Re: Sysdate with time interval parameter [message #638573 is a reply to message #638571] |
Mon, 15 June 2015 09:03 |
cookiemonster
Messages: 13920 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Sysdate is an oracle function that returns the current date.
Oracle dates always include a time component.
An interval is the difference between two timestamps (different datatype to date that includes fractional seconds) expressed in days, hours, minutes and seconds.
Sysdate does not come with a time interval.
So really we're not all sure what you're trying to do, and you need to explain in more details.
|
|
|
|
Re: Sysdate with time interval parameter [message #638581 is a reply to message #638571] |
Mon, 15 June 2015 09:22 |
flyboy
Messages: 1903 Registered: November 2006
|
Senior Member |
|
|
Looks to me like determining a certain time of day derived from sysdate, most probably
select trunc( sysdate-1 ) + 18/24 + 30/1440 yesterday_6_30_pm,
trunc( sysdate-1 ) + interval '18' hour + interval '30' minute another_formula
from dual;
Note the TRUNC function for truncating the SYSDATE (actual date with time) to midnight (day information) and various expressions for adding the required time of day.
|
|
|
Re: Sysdate with time interval parameter [message #638582 is a reply to message #638571] |
Mon, 15 June 2015 10:12 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
RADHAKAN wrote on Mon, 15 June 2015 19:17
For example i need report with sysdate -2 06:30:00 PM to sysdate -1 06:30:00 PM.
As others said, it's confusing. I am just guessing, do you mean you want to use a particular table's column instead of SYSDATE?
Another observation, nothing serious though, you have mentioned your Oracle database version as "11i". Either you are on pre-11g/11g/post-11g, since there is no such version as 11i.
[Updated on: Mon, 15 June 2015 10:24] Report message to a moderator
|
|
|
Re: Sysdate with time interval parameter [message #638583 is a reply to message #638571] |
Mon, 15 June 2015 10:16 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
RADHAKAN wrote on Mon, 15 June 2015 19:17
For example i need report with sysdate -2 06:30:00 PM to sysdate -1 06:30:00 PM.
Are you trying to keep the time portion fixed as "06:30:00 PM" for respective dates while fetching rows between the given range of dates?
|
|
|
|
|
|
|
|
|
|
|
|
|