extract data according to the date and time

Hi all

create table orders

(number of order_id,

number of customer_no

ORDER_DATE date,

primary key constraint orders_pk (order_id))

Insert orders (order_id, order_date, customer_no)

Select 1,7508, to_date (September 15, 2013 22:09 ',' dd/mm/yyyy hh24 ') of double

Union

Select 2,7508, to_date (September 16, 2013 00:09 ',' dd/mm/yyyy hh24 ') of double

Union

Select 3,7508, to_date (September 16, 2013 11:09 ',' dd/mm/yyyy hh24 ') of double

Union

Select 4,7508, to_date (September 24, 2013 05:00 ',' dd/mm/yyyy hh24 ') of double

-need to recover all the commands which made between 15:00 and 08:00 the next day.

I want that my results will look like:

time of orders

time of orders order_id time Hader 4
September 15, 2013 15:00 ' - 16/09 / 2013 08:00115/09/2013 22:09 '.
2September 16, 2013 00:09
23/09/2013 15:00-24/09/2013 08:00423/09/2013-05:00 ".

Please your help.

Naama

My final request-

WITH t1 as

(

Select 1 order_id, 7508, to_date (September 15, 2013 22:09 ',' dd/mm/yyyy hh24 ') double dt

UNION all

Select 2,7508, to_date (September 16, 2013 00:09 ',' dd/mm/yyyy hh24 ') of double

UNION all

Select 3,7508, to_date (September 16, 2013 11:09 ',' dd/mm/yyyy hh24 ') of double

UNION all

Select 4,7508, to_date (September 24, 2013 05:00 ',' dd/mm/yyyy hh24 ') of double

)

SELECT

(CASE

WHEN To_Char (dt, 'hh24') > 12 THEN

(To_Char (Trunc (dt) + 15/24, "dd/mm/yyyy hh24")) | » -'|| (To_Char (trunc (dt + 1) + 8/24, ' dd/mm/yyyy hh24'))

WHEN To_Char (dt, 'hh24')<12>

(To_Char (trunc(dt-1) + 15 / 24, "dd/mm/yyyy hh24")) | » -'|| (To_Char (trunc (dt) + 8/24, ' dd/mm/yyyy hh24'))

END)

time_of_orders, order_id, To_Char (dt, ' dd/mm/yyyy hh24') order_time, header4 NULL

FROM t1

WHERE

DT > = (CASE WHEN To_Char (dt, 'hh24') > 12 THEN

Trunc (dt) + 15/24

WHEN To_Char (dt, 'hh24')<12>

Trunc(DT-1) + 15 / 24

end)

AND

DT<=>

BOX WHEN To_Char (dt, 'hh24') > 12 THEN

Trunc (DT + 1) + 8/24

WHEN To_Char (dt, 'hh24')<12>

Trunc (dt) + 8/24

(end);

It is tested... check my post below.

Tags: Database

Similar Questions

  • Copy the FTP files according to date and time

    Hi all

    I'm creating an application where I need to copy the last file created from a remote FTP site only. Thus, for example, if my remote/ftp location contains some folders and some files, it would list only the file that has been changed recently.

    Right now, NLST and LIST of commands give me the complete list of files and folders directly, but I don't need the file that has been recently modified.

    Can someone help me?

    Hello

    Unfortunately the LIST or the commands do not return good usable change dates and times.

    But there is an FTP task 'MDTM' command to get the date of the change of a specified file.

    You must run this command for each file individually.

    You use the FTP functions from the Internet Toolbox? Then you can do it like this:

    In the response string, you will get the response code (250 for successful operation) and the date of change.

    I think you need to find the last file with little code on the host based on the modification dates.

    Hope this helps

  • Satellite Pro 6100 - how to change the date and time in the BIOS

    Hello

    I received a satellite pro 6100 that had not been used for some time. Windows does not work then he reinstalled with the good drive.

    When I try and windows 'enable', I get the error 32777 and the laptop is unable to connect with the activation servers that a google leads to believe me that the date and time are incorrect in the bios.

    I know that Press esc to access the bios but there is no option to change the date and time in there. I put the date / the correct time in windows, but this does not seem to synchronize with the bios. I've updated to the latest version of the bios, but this is not enough.

    How can I change or update the time in the bios?

    Thank you

    Hello

    I doubt this time and date setting BIOS does affect Windows activation time Windows doesn t affect it in my opinion. There must be another reason for this problem.
    You can activate Windows by phone?

    Normally the date and time in the BIOS can change you if you mark the date or time, and then press on + or - to change this. Sometimes you have to press PageDown/to the top according to the model of BIOS or laptop.
    Usually in the configuration of the BIOS you will find a brief info how changing the values.

    Check this box!

  • date and time of transfer to the target fpga

    Hello world

    Can I transfer the date and time of real time on target fpga in a sbRIO?

    Thank you

    Hello

    You don't know why you would want to try this, can you clarify?  You cannot send the timestamp as it is, but according to what you want to do, there will be a solution.  This describes how a timestamp is stored in LabVIEW, but you probably want to send/receive something more easy to handle on FPGA.

    Michael.

  • How to set the Date and time on a remote target in Measurement &amp; Automation Explorer (MAX)?

    Hello

    I'm trying to follow the steps described in the following link:

    How to set the Date and time on a remote target in Measurement & Automation Explorer (MAX)?

    It is said

    The software on the target currently supports only the time zoneand deletes the old files?

    I need set the date and time

    and remove all the old unwanted files

    the calendar was gray does not allow me to change the current date.

    Anyone know how to change

    Hi all!

    According to this the below Knowledge Base article, Remote Configuration System Support must be installed on the target for time settings to change in MAX.

    http://digital.NI.com/public.nsf/allkb/FAB0EC4D6E5EE0F386257738005733A3?OpenDocument&MeTC=max_MAXDat...

    If you don't know what version of the system supported remote Configuration software that you have installed on your device target, it is likely that it is not yet installed. Add this software by clicking below your target to the MAX software option and selecting "Add/Remove Software". This is where you will install the System Configuration Remote Support software.

    Please let us know if you have any questions!

  • How can I print my photos displaying the date and time stamp

    I have pictures in a legal context but do not understand how to print them displaying the date and time stamp.  The timbre of the date and time are necessary for me to present my case exactly.  Can someone tell me how to print with these marks.

    Thank you

    The following instructions will prepare photos
    with the EXIF Date/time stamp then you can print
    them.

    FastStone Image Viewer freeware can add
    EXIF Date/time in the face of your photos in a batch.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    FastStone Image Viewer
    http://www.FastStone.org/FSViewerDetail.htm
    (Windows XP / Vista / 7)

    I suggest that you create a new folder and add
    copies of your photos for experimental purposes.
    If you are unhappy with the result your originals
    will be intact.

    After FastStone is downloaded and installed...
    Open the program and go...

    Tools / open the Batch Conversion / tab Batch convert...

    Check the box... Use of advanced options...

    Advanced Options button / tab text.
    Check the box... Add text...

    (You will need to experiment with the position and the police
    size and color to get the desired result.)
    (the text size will need to be adjusted according to the)
    the size of the photos)

    Open the window drop... "Insert a Variable."
    choose... EXIF Date Time / Date and time...
    (in the white field you should see ($H1)
    Left click... Ok

    On the Batch tab convert... in the left field...
    Left click the square button "select the Source folder.
    Find and select the photos you want to
    Add.

    Left, click on the Add button to move the files to
    the right field.

    Choose an output Format...

    Choose an output folder...

    Click on the button convert...

    It's much easier to do than to explain then
    give it a try before say you "Good Grief... it's too
    a lot of work.

  • Issue date and time with the javascript scripts

    Hi all

    I need to maintain a bit of history on my pdf form, so I need to get the date and time when the user submits the form.  Currently, I am able to do this in FormCalc.

    var todayDate = Date()
    var todayTime = Time()
    var today = concat (Num2Date (todayDate, "MMMM DD, YYYY"), "", Num2Time (todayTime, "h: mm A") "");

    today will contain: April 28, 2009 14:23

    I want exactly the features in javascript.  I'm not able to get the same result.

    Please give me some code for the same in javascript snippet

    Deepak.

    Hi Deepak,

    This example should show you how you can recover each "piece" of the date in JavaScript and piece and then that their back together according to your needs.

    You will find several examples of scripts on the date formatting here: http://javascript.internet.com/time-date/

  • Can I change the date and time on my account?

    Is there anywhere on this site where I can set the details of the date and time?

    When I posted a recent issue, the date and time were incorrect IE not my country date & time.

    Thank you

    Sylvia

    PS Sorry if this is the wrong place to post this question, not that the possibilities of passage are really there?

    The date and time are universally on us Pacific time zone. You can't change it.

  • How long does take to set up the date and time

    How long does take to set up the date and time

    Less than a minute.

    Settings > general > time zone > set automatically

    If this does not work, try the help in this support article > If your Apple TV will stop to display date and time on startup - Apple Support

  • How do you know the date and time of synchronization in the windows version?

    Where can I see the date and time of synchronization?

    Is there a toolbar button in the Palette to customize. Move this button to a toolbar or in the Menu box open. When you hover over this button, a ToolTip will appear with the day of the week and time of the last synchronization event.

  • Do the photo album, date and time taken?

    Just downloaded all my iPhotos to Photos from the old to the new iMac. All the old photos transferred with the intact title (date and time). How to activate this in Photos? Added some new pictures for the first time to Photos and may not know how to make the title the date and time the photo was taken (without manually typing in the date and time).

    That s not a feature of Photos

    Users contributed scripts to perform these tasks - Script: batch changing the title to the Date of Capture -or http://www.oldtoadstutorials.net/No.P01.html

    LN

  • I want the date and time to stop printing on the bottom of my print outs

    The date and time printed at the bottom of print all. It doesn't matter if it's Firefox, IE, my emails, or even a word document. I tried to remove the header/footer, but because it prints on everything and everything I print, I think it might be a desktop definition...? I am running Windows 7. Help, please.

    Can go you to your devices and printers on your Start Menu and check your settings in your printer? You're right, it could simply be that a bizarre is activated he forced a timestamp on all your printing.

  • As of the 31 version, why is there still no option of Thunderbird to insert the date and time in the message that you write?

    As of the 31 version, why is there still no option of Thunderbird to QUICKLY insert the date and time in the message that you write?

    Literally, saw this option very well needed - and opportunity-"promise" for three years now, and even if there are only one or two formats that could be used, at least the option is there.

    It seems that only is to bind a Macro, and the tool to Thunderbird and do it this way.

    Joe Rotello
    [email protected]
    Skype: joerotello

    If the installation of the add-on of TimeStamp is unacceptable for see you if there is a related add-on that you that you already might have managed to convince author to add your function. The Add on more for example has many variables that can enter the body of the message that get automatically replaced with the appropriate data when you merge a message.

  • is it possible to display the Date and time in the address bar or a clock window constantly

    I need to take screenshots with date stamps and time using the script of iMacros. Everything by taking screenshots iMacro don't add taskbar windows for the date and time. It takes screenshots of browser. Is it possible to display the Date and time in the address bar or a clock within the tab browser constantly to capture the screenshot with time stamp through iMacros
    I added the big clock background Add-ons, but it is visible to new tabs.

    Badly looking for help and it will be really appreciated...

    Try this extension:

  • I want to change the file name format "save under" so the date and time are first.

    When I select a few emails and then select "Save as" to keep a copy on my computer, the name of the file that is created has the date and time at the end of the file name of the email.
    Sample "save under" file name: "Habitat Follow Up - Bryan ([email protected]) - 2011-11-15 0744.eml.
    Is it possible to change the structure or format of the file name if the date and time of the email are initially the file name?

    Try ImportExportTools and customize the format of the file name in the options.

    http://chrisramsden.vfast.co.UK/3_How_to_install_Add-ons_in_Thunderbird.html

  • Automatically set to the Date and time does not

    Date and time settings on my iPad Air set them automatically does not work? When I turn it out it will allow me to choose a city (Knoxville).

    When I turn it on with (location settings) it just turns and turns?

    Any ideas?

    Hello and welcome to Apple Support communities,

    This problem may be caused by a number of things, most often the cause is the device not being able to contact the time server. Here are the instructions from Apple supported for this problem, as well as a link to the appropriate article.

    Follow these steps, after each step:

    1. Make sure you have the latest version of iOS.
    2. Automatically turn on set in settings > general > Date & time. This will automatically put your date and time based on your time zone.
    3. Make sure that your time zone is set correctly. Tap Settings > general > Date & time > time zone.

    If you still have any questions affecting your date, time, or time zone, you can automatically disable in the settings > general > Date & time and manually set the time and time zone. Or contact your carrier.

    The option to enable the value automatically may not be available in all countries or all shells.

    If the time on your iOS device does not go after a sync with your computer, the computer may be time wrong. Check the time on your computer in system preferences > Date & time. You can select "Set date and time automatically."

    Support the Article HT203483

    Get help with the date and time on your iPhone, iPad and iPod touch - Apple Support

    Of course, if the time of your carrier server cannot connect the other option is to manually set the date and time until the carrier server are again available.

    Hope you helps out.

    Kind regards

    Peter.

Maybe you are looking for