concatinating the time with date...

Hello
I have the column in a table that store the time from 00:00 to 23:00 hr with a different interval for each item.
I show this column with the current date time.
for example:
Table A:
expected_time
22:40
23:00
20 x 30
01:20
04:10
04:40

Table B:
Article expected_dep
XYZ
ABC
I want the query to insert into table B as sysdate expected_dep + the expected_time min value where to_char(sysdate,'hh24:mi) > present
Assume that sysdate is 2012-12-08 and sys the time now is 23:25, then the expected_dep should be 2012-12-09 00:30.
Can anyone help solve this query.
Thanks in advance...

Benz says:
This is the output result you can see the time is ok, but the date is not correct.

You must be more precise. What result do you expect? The way I understand your reqs is we find then next time sysdate in the table has. So if the current time is 02:01 next time nearest you to table a is 06:00. If you want to get the closest time to the current time any direction:

update  b
  set expected_dep = (
                      with t1 as (
                                   select  expected_time - trunc(expected_time) d
                                     from  a
                                  union all
                                   select  1
                                     from  dual
                                 ),
                           t2 as (
                                  select  trunc(sysdate) + d expected_dep,
                                          row_number() over(order by abs(d - (sysdate - trunc(sysdate)))) r
                                    from  t1
                                 )
                      select  expected_dep
                        from  t2
                        where r = 1
                     )
/

And to imitate 2012-12-10 02:01:

update  b
  set expected_dep = (
                      with t1 as (
                                   select  expected_time - trunc(expected_time) d
                                     from  a
                                  union all
                                   select  1
                                     from  dual
                                 ),
                           t2 as (
                                  select  trunc(to_date('2012-12-10 02:01','yyyy-mm-dd hh24:mi')) + d expected_dep,
                                          row_number() over(order by abs(d - (to_date('2012-12-10 02:01','yyyy-mm-dd hh24:mi') -
                                          trunc(to_date('2012-12-10 02:01','yyyy-mm-dd hh24:mi'))))) r
                                    from  t1
                                 )
                      select  expected_dep
                        from  t2
                        where r = 1
                     )
/

4 rows updated.

SQL> select  *
  2    from  b
  3  /

ITEM       EXPECTED_DEP
---------- -------------------
xyz        12/10/2012 02:00:00
abc        12/10/2012 02:00:00
def        12/10/2012 02:00:00
ghi        12/10/2012 02:00:00

SQL> 

SY.

Tags: Database

Similar Questions

  • Any server time I select to synchronize the time with, it is said: ' year error occurred while Windows timed with, (insert.server.here).

    Choose any server to synchronize the time with, it says, "an error occurred while Windows timed (insert.server.here) with," can someone please tell me why this is, or particularly how to solve this problem?  I am trying to connect to NetFlix with Windows Media Center, and as you can probably guess, I'll have no chance.  He told me, INVALID TIME SETTINGS.  Your computer's clock is set for an hour and invalid date or is not correctly adjusted for daylight saving time.  Update the settings of the clock, then try again.  Even when I set the time manually it will not work.  I just don't understand.  Help, please!

    Hello

    How to fix synchronization of time Internet - add your own time server
    http://www.edbott.com/weblog/?p=1779

    Dealing with Windows Vista time sync problems
    http://www.howtogeek.com/HOWTO/Windows-Vista/dealing-with-Windows-Vista-time-sync-problems/

    Synchronize your clock with time servers Internet from the Vista command prompt
    http://www.howtogeek.com/HOWTO/Windows-Vista/sync-your-clock-with-Internet-time-servers-from-the-Vista-command-prompt/

    Time synchronization on Windows XP and Vista with Internet
    http://www.techexams.NET/blogs/jdmurray/synchronizing-the-time-on-Windows-XP-and-Vista-with-the-Internet/

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • can anyone help me find an app for the Zeen which has just the time and date? Don't want to google.

    I don't know how to use the apps since all I found is on android, but apparently the Zeen is not compatible with the android apps.  I have google calendar, but it doesn't work and want to only the time and date is displayed.  I followed all the directions for adding applications, but they do not work or I can't understand them.

    Salvation of theeagles,

    The Zeen is unable to access the Android Market, but it's an Android device.  There is a market for this called SlideME, and you should have the icon for it in your apps section.  I have a station also, and I'm just a normal clock on mine.

    Here is a link to SlideME, if you want to see what applications are available: http://slideme.org/

  • How to change the time and date on the desktop?

    My computer does not show the time and date.

    I tried several times to update the date and time, but after the judgment the same problem persists.
    How to solve the problem?

    Mr. Thanapackiam I know that this issue please follow my steps

    Step 1:-go to the Start Menu and Type "region and language" and press enter
    Step 2:-go to the location tab and select your current location
    Step 3:-go to the Start Menu and Type "Services" and press ENTER. (i.e. open Services)
    Make sure that the Windows time service is running.
    Step 4:-click Date and time on the far right of the taskbar.                           Click Change Date and time settings.
    Step 5:-click Change Date and time settings button to change the date and time
    Step 6:-Click Internet Time to synchronize the time with the Server online
    Step 7:-   click on change settings , then update now

    Thank you
  • Change the time and date of deposit when importing

    Hi everyone, when I import images in my project, automatically first change date and time with the current date and time in the finder. So each imported file have changed the time and date when I search in the finder under the "created" or "modified" column, is this normal?. There is no way to avoid this?

    Thanks in advance

    Yes, you can prevent this! Go to the preferences of first and go to the media section. Uncheck "Write XMP IDS to files on import". Boom, done. First will not add his small beacon of metadata files when you import them. This isn't a huge deal for most publishers except Adobe apps could create media Cache files more than necessary if you re - use clips in other projects. Don't forget, however, anything, if you change the metadata (in the project Panel or metadata) file, it'll still change changed data for the clips.

  • How can I get the time and date appears on a sony cyber-shot camera

    How can I get the time and date appears on a sony cyber-shot camera

    Hi terpmarty,

    What is the model number of the Sony Cybershot camera?
    Instructions for superimposing the date and time are model specific. Some models do not have the ability to superimpose the date and time too. In such a case, you can use the supplied software Picture Motion Browser (PMB) or PlayMemories home (WPH) (Compatible with the Windows operating system) to print the date and time on pictures.

  • Whenever I have turn off my pc and reboot later, the time and date go to 0.00

    Original title : improve system performance slow slow start

    Whenever I have turn off my pc and reboot later, the time and date go to 0.00

    Probably means the ROM BIOS chip gone bad and must be replaced. Its a small coin like chip located on your motherboard. You should be able to buy one on where one sells computers and electronic products.

    How to replace the BIOS chip on a motherboard . eHow.com

  • Clock-calendar does not maintain the time and date

    The clock-calendar on my laptop does not maintain the time and date after I put it.

    Usually a sign that the bios cmos battery is defective and must be replaced

  • How can I reset the time and date on Windows Vista?

    How can I reset the time and date on Windows Vista

    http://www.ehow.com/how_2056384_change-date-time-Windows-Vista.html

    http://www.Vistax64.com/tutorials/114989-date-time-change.html

    Read the information in one of the links above.

    See you soon.

    Mick Murphy - Microsoft partner

  • How to set the time and date on printer n911a e-all-in-one officejet pro 8600.

    How do you set the time and date on printer n911a e-all-in-one officejet pro 8600. This info is not in the user's guide or the getting started guide.    Thanks in advance. Jim

    Jim go to settings on the 8600, click Preferences.

    There is an option DATE and HOUR.

  • ETA App should help to get the time and date feature HELP!

    Hi everyone, I'm doing an application where I need to get the time and date of the antone device can help, I know there is a function such as getDate or getTime but im not to know how to use it.

    As far as I know,

    I use this to get the time system (it returns long type)

    System.currentTimeMillis();
    

    After that, you can use SimpleDateFormat to convert date and time

    SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy, HH:mm");
    String time = sdf.format(new Date(System.currentTimeMilis()));
    
  • When you use the plan of photography can I be connected to the internet all the time? Data are always deducted when using Photoshop or Lightroom?

    When you use the plan of photography can I be connected to the internet all the time? Data are always deducted when using Photoshop or Lightroom?

    You should not have a permanent internet connection.  You should only be connected when the software must check whether the subscription is still valid.

  • How to get the time to date?

    Hi Sir,

    I need to recover the time to date.

    ' like ' 2012-10-03 04:32.

    to retrieve the only time where it's 04:32

    What is the query for this?

    Thank you

    Hi user,

    You can use TO_CHAR function to obtain the hour alone

    SELECT TO_CHAR (TO_DATE ('2012-10-03 04:32:00', 'YYYY-MM-DD HH24:MI:SS'),
                    'HH24:MI:SS'
                   ) TI_ME
      FROM DUAL
    

    Thank you
    Shankar

  • How to set the time with ntp

    Hello

    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product
    Release of centOS 4.8 (Final)
    VMWARE vsphere client

    I have a question about NTP. I recently discovered that I forgot to install and configure ntp on my server. The time is now 15 minutes before.

    What would be the best way to fix this without closing the database? (if possible)

    The only thing I could think off closure of the database and ntpdate < time_server_ip >.

    Thanks for your time,

    Kind regards...

    Yucon28 wrote:
    Hello

    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product
    Release of centOS 4.8 (Final)
    VMWARE vsphere client

    I have a question about NTP. I recently discovered that I forgot to install and configure ntp on my server. The time is now 15 minutes before.

    What would be the best way to fix this without closing the database? (if possible)

    The only thing I could think off closing the database and ntpdate .

    Thanks for your time,

    Kind regards...

    Oracle does not really. Allows you to adjust manually the time with ntp is no different to the database of the BONE by automatically adjusting the change to and from DST. Oracle following its transactions by RCS, no time.

  • Identify the tables with data or not

    Hello

    I want to find the tables with data and containing not data without checking each table. Is there a possible way?

    Like this?

    select
      table_name,
        to_number(
          extractvalue(
            xmltype(
     dbms_xmlgen.getxml('select count(*) c from '||table_name))
            ,'/ROWSET/ROW/C')) count
      from user_tables;
    

    Or may be

    select
      table_name,
       CASE WHEN
           to_number(
              extractvalue(
                xmltype(
         dbms_xmlgen.getxml('select count(*) c from '||table_name))
                ,'/ROWSET/ROW/C'))>0 THEN 'Table Has Data'
        ELSE 'Table is Empty'
        END
      from user_tables;
    

Maybe you are looking for