Problems while extracting the hours of the Date field

Hi guys,.

We hope that you do well.

I am facing some problems during extraction of the hours of the date field. Here is an example of my orders table:-

Select * from orders;

Arrival time of Order_NO product name
1 computer Office November 20, 10 10:10
2 November 21, 10 17:26:34 portable
3 22 January 11 printer 08:10

Earlier, it is stated that the daily number of orders take place in the roll of the order, I used to write a query

arrival_time > = trunc ((sysdate-1), 'DD')
and arrival_time < trunc ((sysdate), 'DD')

The above query gives me yesterday how many orders have been been held.

Now I have the new requirement to report on every 4 hours the number of orders will be held. For example if the current time is 08:00 IST then the query must extraction from 04:00 until 08:00 how many orders took place. The report will take place at 12:00 IST which will give me an order took place from 08:00 until 12:00.

The report will be run every 4 hours per day and generate report of orders taken place for the past 4 hours. I have a programmer who will run this query every hour, but how to understand to get the order at the request of details who arrived for the past 4 hours. I'm not able to do this using trunc.

Can you please help me how to make this happen. I checked "Extract" also, but I am not convinced.

Help, please.

Thanks in advance
Aalami

try something like

with testdata as (
  select sysdate - level/24 t from dual
  connect by level <11
)

select
  to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS') s
, to_char(t, 'DD-MM-YYYY HH24:MI:SS') t from testdata
where
t >= trunc(sysdate, 'HH') - numtodsinterval(4, 'HOUR')

S     T
19-06-2012 16:08:21     19-06-2012 15:08:21
19-06-2012 16:08:21     19-06-2012 14:08:21
19-06-2012 16:08:21     19-06-2012 13:08:21
19-06-2012 16:08:21     19-06-2012 12:08:21

trunc (, 'HH') truncates the minutes and the seconds of the date.
Extract the hour only works on timestamps
concerning

Published by: chris227 on 19.06.2012 14:13

Tags: Database

Similar Questions

  • Error when you try to play .wmv files: Windows Media Player has encountered a problem while playing the file. For any additional help, click Help on the Web

    Will not play WMV video files

    I'm having a problem to play wmv. video files.  I have windows vista.  I can play music in Windows Media Player, but can not play any video, that is sent to me by e-mail.  WMP crashes and give a message saying that Windows Media Player has encountered a problem while playing the file. For any additional help, click Help on the Web.  I click web help and receive nothing.  The drivers are up to date.  Why I can't play videos? Thank you

    Hello Henry Michael,.

    Please relay the e-mail program you use.  You can also try to save the file directly on your local computer, and then check if the file is being read correctly. If there has been any recent codec package installation, you can also try to temporarily uninstall the codec package and then check out the question.

    Thank you

  • Foglight v6 - FaultException: impossible to extract the data of inventory of the collector

    After having modernized our virtual center to V4, the foglight fails to report all the details and only has the following alert:
    "FaultException: impossible to extract the data of inventory of the collector: the parameter name cannot be null or an empty string."
    ' Parameter name: key to make sure the collection agent service is running.
    If anyone else has had this problem and how to solve?
    Thank you
    Karim

    Hi Joviyach,
    I logged a call with Vizioncore and the resolution is as follows:
    the problem you have is related to a VMware problem experienced during the upgrade to vSphere 4.0 as detailed in: kb.vmware.com/.../search.do
    Bascially, you must run a SQL command of your Virtual Center via MS SQL Management Studio that will identify one or more VMs who have a missing entry in the VPX_VIRTUAL_SCSICONTROLLER table. Once this information is determined that you would follow the steps 2 to 6 of the reolution... basically remove these virtual machines of the inventory and adding them back.
    When these steps are complete, you will re-start the vFoglight Collector of Vmware and Vmware vFoglight connector services.

  • There is no sound in my computer and I also get the error "Windows media player has encountered a problem while playing the file" while trying to play audio in Windows Media Player.

    Original title: what is a possible cause for any audio?

    Whenever I try to play any type of audio file I get the error message "Windows media player has encountered a problem while playing the file." All of my audio is disabled, no notification sound, no in his game. All audio drivers are up to date and when I try to diagnose the problem, he told me that there is no problems found. It also gives me this error message when you try to play video files or listen to internet radio on the media player.

    Hello

    If I understand correctly, you are facing problem with playback of the audio files in Windows Media Player. I would like to know more information on the issue, so that we can help you better.

    1. have you made changes on the computer before this problem?

    2. is it works much earlier?

    Let us try the following methods and check if it works for you.

    Method 1:

    Run the troubleshooter in Windows Media Player.

    Open the troubleshooting Windows Media Player settings Troubleshooter

    http://Windows.Microsoft.com/en-us/Windows7/open-the-Windows-Media-Player-settings-Troubleshooter

    Method 2:

    Try to re - register the files associated with Windows Media Player.

    a. Click Start, type 'regsvr32 wmp.dll"without the quotes into the search option and press ENTER.

    b. restart your computer later.

    Also see the following Microsoft to issue his No. article.

    http://Windows.Microsoft.com/en-us/Windows7/tips-for-fixing-common-sound-problems

    http://Windows.Microsoft.com/en-us/Windows/no-sound-help#no-sound=Windows-7&V1H=win8tab1&V2H=win7tab1&V3H=winvistatab1&v4h=winxptab1

    Please reply with the status of the issue, so that we can better help you.

  • No matter what I try to play, I get this message, "Windows Media Player has encountered a problem while playing the file." And the media player does not work

    Windows Media Player

    No matter what I try to play, I get this message, "Windows Media Player has encountered a problem while playing the file."  And the media player does not work

    Reset the WMP.

    Step by step instructions are given here: -.

    http://www.mydigitallife.info/how-to-uninstall-and-re-install-Windows-Media-Player-12-WMP12-in-Windows-7/

  • Windows Media Player encountered a problem while playing the file. (MPEG)

    Windows Media Player encountered a problem while playing the file. (MPEG)

    Don't know why Windows Media Player does not accept your mpeg.

    Just a suggestion:

    Use a video converter and change your mpeg to wmv format and read it.

    If you don't have a video converter, google for a free Converter. No need to buy a.

    You can also install VLC media player.
    It's free.
    He plays almost all kinds of formats.
    It is widely used and recommended.

    If you are interested, here is the link:

    http://www.videolan.org/VLC/

  • Windows Media Player does not. I get the message "Windows Media Player encountered a problem while playing the file. For any additional help click web help. »

    Original title: Windows Media Player does not

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    I have Windows XP Professional and have tried playing the CD through Windows Media Player. I get the message "Windows Media Player encountered a problem while playing the file. For any additional help click web help. "Then I do. Nothing here helps me. The player shows all my music but puts little red x showing that he can't play. Help! I downloaded version 11 of Windows Media Player, but it is saying the same thing.

    Thank you.

    Hello

    1. don't you also get an error with the message code?
    2 have you installed third-party readers part?
    3. What is the format of the files you are trying to play?

    Follow these steps and check if they help.

    Step 1:

    I would have you readers of third party temporarily Uninstall and check if persists it to the question.

    Step 2:

    Most likely you need codecs to play these files with Windows Media Player. I suggest looking up codec in the Internet that supports the file format, download and install them.

    See also:

    Player Windows Media for Windows XP supported Codecs

    WARNING OF THIRD PARTY
    Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    See also:

    Windows Media Player Error Message help

    Aziz Nadeem - Microsoft Support

    [If this post was helpful, please click the button "Vote as helpful" (green triangle). If it can help solve your problem, click on the button 'Propose as answer' or 'mark as answer '. [By proposing / marking a post as answer or useful you help others find the answer more quickly.]

  • Error when you try to play multimedia files: Windows Media Player has encountered a problem while playing the file. For any additional help, click Help on the Web

    ERROR: Windows Media Player encountered a problem while playing the file. For any additional help, click Help on the Web.

    I get the error Windows Media Player 11.0.6001.7007.  "Windows Media Player encountered a problem while playing the file. For any additional help, click Help on the Web frequently. "What happens on the music or video files even those I had on my PC for a long time.  They work some days and other days they don't.  I have to reboot to clear it and it's really annoying. I can read a file and then 10 minutes later the same file will not play.  Sometimes after the error message, if I don't click Close, the video is not yet but the audio will not.

    I'm on a laptop HP DV5 with vista 32-bit and 4 GB memory such that shipped HP (Yes, 4 concerts and 32-bit).

    I don't know if it was related, but IE7 would continually fail to open, click on through the windows and should be completely closed.  essentially the WMV and IE are fails miserably on this laptop, and it was only 6 months old.  Firefox fixes my problem of browser.

    How can I fix this WMV as I can't UN/reinstall with Vista?

    I ran sfc/scannow after completion of the analysis, the results were that "windows resource protection finds corrupted but files could not solve some of them" gives then refers to where the cbs.log file is located. I tried to open the cbs log, and he says that access is denied.

    UPDATE: there seems to be a conflict between WMP and any other application that opens which can play the video with sound.  When I close firefox, and then the videos and sound can play (these same questions happened on IE7 and firefox was installed just yesterday).  I met the same problem with more than Pinnacle video editing software.  Is it possible to change a parameter with WMP as there is no sharing violation during a different application can play the video?

    SO thanks a lot!    I had to use the following steps to get your simple solution:

    1. Select Options under the button 'SYNC '.

    2. choose 'other Options '.

    3. click on the tab 'network '.

    4. only check box RTSP/TCP and HTTP and Multicast Streams allow the player Pourrecevoirun multicast stream (which meant I had to uncheck "RSTP/UDP"

    5. click on apply and take advantage of my windows media player.

    Thanks a lot wmd_user!

  • Error reading of disks: Windows Media Player has encountered a problem while playing the file

    Im having a prob. with my Media Player, everthing was working fine until about 15/04/2010.

    Im having a prob. with my media player from vista, everthing was working fine until about 15/04/2010. then all I get when I put a disc that worked before the time this message (Windows Media Player encountered a problem while playing the file. For any additional help, click Help on the Web.)

    any thoughts?

    Hello SUNCITYDAVIS,

    ·         Remember to make changes to the computer (hardware or software) before having this problem?

    ·         Do you get this error during playback of all media files or any size of file in particular?

    ·         This happens when you play multimedia files stored on your computer as well?

    The error indicates that there could be some missing codecs for the file format, you are trying to play with Media Player.

    You can see the article that will give you information about the codecs:

    http://www.Microsoft.com/windows/windowsmedia/player/FAQ/codec.mspx

    Thank you
    Irfan H, Engineer Support Microsoft Answers. Visit our Microsoft answers feedback Forum and let us know what you think.

  • Windows 7 - Windows Media Player encountered a problem while playing the file.

    WMP worked fine one day and then the other, it will not play any type of file.  I just get the error message "Windows Media Player encountered a problem while playing the file." with each trying to play any type of file.  It won't play video or audio files, even those she played a few days ago.

    Dano_TR: try to use system restore to restore to a point from before the problem started to happen, as I have suggested earlier in this thread.

    In addition, if you have any installed codec Pack, try to remove the. Uninstall iTunes and Quicktime could also help.

    Tim Baets
    http://www.BM-productions.TK

  • get the error message"Windows Media Player has encountered a problem while playing the file. "When tying to play videos on my memory card

    get the error message"Windows Media Player has encountered a problem while playing the file. "When you try to play videos on my memory card

    Hello

    1. What is the format of the video file you are trying to play?

    2. do you have any third party audio or video codec installed?

    Follow these methods.

    Method 1:  Run the troubleshooter in the Windows Media Player settings.

    Troubleshooting looking for issues related to playback of audio and video files in the drive by checking its configuration and network parameters.

    Open the troubleshooting Windows Media Player settings Troubleshooter
    http://Windows.Microsoft.com/en-us/Windows7/open-the-Windows-Media-Player-settings-Troubleshooter

    Method 2:
    If you have installed any third-party codec or plug-in for Windows Media Player, uninstall them temporarily to check if they are causing the problem.

  • How to solve "here has been a problem to read the data in the layer. read the composite data instead? »

    Hello

    I'm working on the UI for a 2 month Word Press theme, and it has a ton of layers with file size of 900 MB.

    When designing, I get a message that says:

    "here was a problem to read the data in the layer. read the composite data instead? »

    Please solve this problem because I am so tired of working on this that I don't want this effort in vain.

    and sorry if my English is bad.

    dffd.jpg

    Hi AymanAlrifai,

    Would you be able to share the file problem with me zipped upward? petgreen [at] adobe [dot] com

    I'll see if I have the same problem and check with the team to investigate the issue here and see if we can resolve it for you.

    Kind regards

    Pete

  • Installation of the Photoshot 13 elements. error message: "this is a problem when extracting the files. Check the amount of space available on your computer and the rights to write to the destination folder. I have 1.38 TB of free space and total control

    I try to install photoshop elements 13, that I bought and downloaded from Amazon. When I try to install it I get the following error message: "this is a problem when extracting the files. Check the amount of space available on your computer and the rights to write to the destination folder. I administrar 1.38 TB of free space and total control.

    Charles please do not remove the installation files in the Program Files directory.  I recommend to extract the installation to your downloads folder or your desktop files.  Once installation files are extracted, you can then run the installation program to install Photoshop elements 13.

  • extract the date year

    Hello

    IAM using obiee 11g, hold extract the date year
    CAST (YEAR ("ABC". "DATEADDED") as varchar (4)) "
    so used like that

    But I want as if the year is 11 2011 then only I want y at - it a direct function that does this.

    Thank you

    You can use the right right function (year 2). Will return 11 if the year 2011

  • Is there one way other than to_char to get the month of the date field

    Is there one way other than to_char to get the month of the date field

    Hello

    raj4tech wrote:

    Is there one way other than to_char to get the month of the date field

    EXTRACT is one:

    SELECT INTERESTED (SYSDATE MONTHS) AS curr_month

    DOUBLE;

Maybe you are looking for

  • Camileo s10 - new pictures are completely white

    I have a problem with my Camileo S10.The display is white, and in addition to the batery meter it is a sign of sd green.I changed the sd card, but it's the same. Nothing has changed.I see on the screen the old photos from an sd card, but the news is

  • failure of MOTOBLUR account

    I have a motorola charm. I bought it off of ebay and I don't have a data service. When I had yesterday it took me 2 hours to finally get a motoblur account. but then I've played with my sd card and did not know that I have to take it apart until I ge

  • printer V505 tells me that I need to align or troubleshoot it after putting in new ink

    Original title: troubleshooting printer v505 I'm having a problem with a printer v505 I brought some ink the other day know it says to align or to troubleshoot it. How to do that. what you think is the problem.

  • 1312 nfi MFP color laser: blank white screen

    When on copier, HP blue screen starts initialization and become white, nothing happens, then the screen starts during initialization or print document whites then.

  • Get-VDport data missing

    I'm having a strange experience with Get-VDPort. I do the following: Get-VDSwitch | Get-VDPort -Uplink | where proxyhost -match "$($ESXHost.name)" It is in a loop many esx hosts.This should produce all uplinks in each vdswitch but I am missing the up