Add the value of time to a Date value

Hello

COLUMN A is of TYPE DATE i.e. * 14 March 13 12:30 *.
B of the COLUMN is a CHAR Type for hours and minutes: i.e. * 01:45 *.

I'm trying to sum (in SQL) time in A collar with collar B, the result must be: 14:15

I'm not sure how to proceed

Thank you

Ruben

Hi Ruben,.

Here's one way:

WITH     got_b_date     AS
(
     SELECT     a, b
     ,     TO_DATE (b, 'HH24:MI')     AS b_date
     FROM     table_x
)
SELECT     a, b
,     a + ( b_date
         - TRUNC (b_date)
         )        AS a_plus_b
FROM    table_x
;

This assumes that the part b hours between 0 and 23, and part minutes is between 0 and 59.
If you need to accept all whole as the hours and minutes, then:

SELECT     a, b
,     a + ( TO_NUMBER ( REGEXP_SUBSTR ( b
                                 , '^\d+'
                         )
               )
         / 24
         )
       + ( TO_NUMBER ( REGEXP_SUBSTR ( b
                                 , '\d+'$
                         )
               )
         / (24 * 60)
         )        AS a_plus_b
FROM    table_x
;

Published by: Frank Kulash on April 22, 2013 12:03

I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data. Include all you need to manage special cases (for example, the NULL values, or b without ':').
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002}

Tags: Database

Similar Questions

  • Add the primary when key out aleady data

    Hello

    I have a table with the following structure.

    CREATE TABLE 'CONTRACT_NOTIFICATIONS '.
    ("CONTRACT_NUMBER" VARCHAR2 (255),)
    VARCHAR2 (1) "BILLTO_SUPPORT_ACK."
    VARCHAR2 (1) "CUSTOMER_CONTRACT_ACK."
    "EMAIL_TO" VARCHAR2 (255),
    'OBJET_MESSAGE' VARCHAR2 (255),
    'EMAIL_CONTENT' CLOB,
    'CREATED_BY' VARCHAR2 (255),
    "CREATED_DATE' DATE default sysdate,
    VARCHAR2 (50) 'NOTIFICATION_TYPE '.
    )
    /

    The above table has 5000 + files, my requirement is we need to add a column named ID as the primary key and add the value of the unique sequence in this way to make this offer to me please.

    Thank you
    Sudhir

    Without copying into the temporary table, just build indexes and a primary key at the end:

    ALTER TABLE contract_notifications ADD (id INTEGER);
    
    CREATE SEQUENCE testseq;
    
    UPDATE contract_notifications
       SET id = testseq.NEXTVAL;
    
    CREATE INDEX pk_contract_notifications
       ON contract_notifications (id);
    
    ALTER TABLE contract_notifications ADD (
      CONSTRAINT pk_contract_notifications
      PRIMARY KEY
      (id)
      USING INDEX pk_contract_notifications);
    {code}
    
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    
  • Add the value of point two apex and display the result in another part of the apex

    Hello

    I need to make the addition of the two item values using apex.item.text and find the result in another apex.item.text.

    For example:
    SELECT
    apex_item. Text(1,null) ONE
    apex_item. Text(2,null) TWO
    apex_item. Text(3,null) RESULT
    FROM EMP
    please suggest me

    Thank you
    Sudhir

    >
    No it does not add the two values in the column, user key to enter the value, it must add the value of the item and displays the result in a dynamic way. Need a suggestion for using javascript
    >
    This requirement was not not clear in the op.

    See the demo of Denes Kubicek.

    This topic is discussed far too often. Have you tried to Oracle Application Express (APEX) and adapting one of the many examples of LoV cascading to your situation?

    See you soon,.

    PS: Tip:
    Look for the p_item_id and p_attributes of the APEX_ITEM API parameters.
    You can call JS functions for example using p_attribute

    APEX_ITEM.TEXT(...
    p_attributes => 'onchange="doTotal(this);"', /* doTotal being your JS Function */
    ...
    

    Published by: Dominic August 16, 2012 11:52

  • No idea how to loop and add the value to the attribute of the xml node?

    I work on a lot of flattening of project using a watched folder.

    I have a process parent to locate the directory and call a sub-process to flatten PDF files.

    I want to write the directory failed to XML.

    If there are several directory failed locations and if I want to add it to the node, he doesn't let me do.

    If I set the Xpath location like/process_data/outputXML/flattenDirectoryRequestMessage/failureFileLocation[x]/@path it gives me invalid character exception. I use 'x' for looping and incrementing.

    If I do not use the [x]. The directory is overwritten.

    No idea how loop and add all the directories failed to attribute of the xml node?

    I understand that you can not browse the xml code to assign the value at each node. Rather you can assign only one time to the node.

    I realized that it is not possible to do it this way. Then concatenate it as strings, and then attach to the xml once.

  • Add the Value property in the ATG import feature

    Hello

    When we try to add more values to the list via the import BCC option property, the old values are deleted and the new values are added. We need to have the old values and new values for the property.

    For example,.

    34345 product, sku 74747 is already mapped in the childSku. We try to add 74748,74749 Sku of as childsku via the import of the BCC option. The old value 74747 is replaced by 74748,74749.

    But the expectation is that we have all three references 74747,74748,74749 to map to 34345 product sku.

    Got the solution documentation below

    http://docs.Oracle.com/CD/E26180_01/platform.94/ATGMerchandisingUserGuide/HTML/s0606formattingafileforimport01.html#s0606formatforaddingitemstoacollectio01

  • Cannot add the NFS share to store Cluster data

    Hello

    I have this scenario:

    Server - FREENAS with NFS share

    -cluster with 2 guests

    I added the NFS datastore successfully to each host in the cluster. The problem is when I try to add the NFS Datastore for the Cluster data store, I get the error: a specified poarameter was not correct. datastore.info.type.

    Any suggestions would be much appreciated.

    Thank you.

    Datastore1 and datastore2 data warehouses are data warehouses local? If so, you must remove these storages of data added before the NFS datatore to the cluster, first cause a cluster cannot be VMFS and NFS on the same cluster and second cause without making sense have warehouses of local data within a cluster data store.

  • Logic problem.  JavaScript will not correctly add the values

    Simple logic problem.  I have radio buttons fixed to values 1 or 0, but the simple addition of characteristic adobe has used it add up?

    Basic story, I need to display the value of how no. GOs there, then multiply the amount of GOs No. against a locker's worth.

    While subtract 100 to get an academic score.

    Code to determine the value of a set of radio buttons;

    Switch (this.getField("Group_1").value)

    {

    case 'GO ':

    Event.Value = 0;

    break;

    case "NO GO":

    Event.Value = 1;

    break;

    }

    On the calculation tab, I then use the first calculate (sum +) selection to determine all areas, I would like to add (total of 24 possible selections) field name is (TOTALNG)

    After that I have a hidden field that multiplies the previous value TOTALNG * 4 (which represents the value of the note I want to determine each no. GO), then displays

    the total final that I simply subtract 100.

    It is, he does not appear correctly the initial value of the no-go. It is always 1 account back up to what it should be. I even select the radio to go button which resets the value to 0, but down altogether, it counts as if it is chosen and gives a value of 4.

    A way simple code so far, even seems (if the way im put it on foot does not tell you that I know little) but I do not understand what I can be missing. I even put a field of 0 to add in now just to see if she needs another value to add against just in case where there is that one number GOING to add.

    Any idea? My form is a probably a mess, but I think the code is simply stated if anyone is willing to look and laugh for a second to my work.

    Thank you

    The problem seems to be the order of computation of field, only not with the

    code. You can configure via a Set - other tasks - field form editing mode

    Calculation order.

  • Add the value of the column to MRU

    Hello
    I'm sure there is a simple solution to what I see, sorry if this is the case.

    I would add column values to the update of the Apex Multi line. These values are the elements on the page, apart from the form of paintings, but common to all lines updated.

    In other words, offer will save values in tabular form with the standard MRU and then a process of "trigger as" should add these additional values.

    How can I do this without having to create a custom MRU?

    Thank you
    Marc

    Hello

    I see two methods that may work.

    First of all, you say "trigger like' - why not use a real trigger for do? The values in your page items would be available using nv('Pnn_ITEMNAME) in the trigger code.

    Alternatively, you can include the column in the form of your table, and then use javascript to hide. Then, again using javascript, you could update the field until the submission process is triggered by the button. The button should call this function and then use doSubmit() to submit the page.

    Andy

  • Add the value of table row selected PageFlowScope so that I can access taskflow

    Hi all

    Facing a problem of getting a value from a table ADF selected line to a taskflow that appears as an inline popup. Here's the scenario. I have a vision that shows a table. When I click on an edit btn I display my taskflow as an inline popup. What I would do, is to take the line of the selected table, remove lets say the value of line name and pass it on to my taskflow for display. I tried this value within an mbean settting when I click the btn edit using:
            AdfFacesContext.getCurrentInstance().getPageFlowScope().put("editTargetNameSource", targetName);
            String tmpClear = (String) AdfFacesContext.getCurrentInstance().getPageFlowScope().get("editTargetNameSource");
    That seems to get together, but when I try to enter this value using EL inside my page of jspx taskflow it seems to be not defined.
     <af:outputLabel value="Selected Row" id="ol1"/><af:outputText value="#{pageFlowScope.editTargetNameSource}"
    It seems that pageFlowScope for my taskflow popup! = pageFlowScope for page my table saw to. I tried to put this as a parameter of the entry page, but I have the feeling that I missed something. I wish I could set this value within my bean when a user clicks the edit btn and then display that value in my taskflow popup.


    Any help is appreciated,
    -Wraith

    RequestContext requestContext = RequestContext.getCurrentInstance ();
    requestContext.getPageFlowScope () .put ("editTargetNameSource", targetName);

  • How to add the values of the data from two lines

    We enter the data as

    name values
    ==== ====
    a 100
    b 125
    c 140

    We need output of

    total of the Name values
    ==== ==== ====
    a 100 100
    b 125 225 (100 + 125)
    c 140 365 (225 + 140)

    How do I solve this problem... ?

    1008318 wrote:
    We enter the data as

    name values
    ==== ====
    a 100
    b 125
    c 140

    We need output of

    total of the Name values
    ==== ==== ====
    a 100 100
    b 125 225 (100 + 125)
    c 140 365 (225 + 140)

    How do I solve this problem... ?

    Hello

    SQL> with test_data
      2  as
      3  (
      4  select 'A' name,100 val
      5  from dual
      6  UNION ALL
      7  select 'B',125 from dual
      8  UNION ALL
      9  select 'C',140 from dual
     10  )
     11  select name,val,sum(val) OVER(order by val) total from test_data;
    
    N        VAL      TOTAL
    - ---------- ----------
    A        100        100
    B        125        225
    C        140        365
    

    Kind regards
    Claudy K

    Published by: Claudy K on May 28, 2013 02:52

  • Text added in loop file adds the value of delimiter unwanted at the end of each iteration.

    I use 'Export to Spreadsheet.vi' in a loop that records a text file and adds data to a waveform table 1 d for each iteration. My problem is that, at the end of each iteration of what an extra delimiter value is added to the file. When I then try to graph my data, I get the holes, as shown below (circled in black).

    When I start to analyze the data, I'm sure it will be a nuisance. I can't find a solution to this problem. Any advice would be greatly appreciated.

    Thank you.

    Any wire TRUE here

  • Add the value of column based on a different line with the same id

    Hello world

    I have a query that displays the first three columns of the table below. I would like to add a column to this output, most indicating (for each row) if there is an electronic product in the same order. For example, the command 1 in the table below contains 1 unit of furniture and 1 unit of electronics. In my outings, I would add a flag 'Y' for the two rows 1 and 3. Also, I would add a "N" indicator to any order which does contain all the electronics.

    Any ideas on how to achieve this? Any idea or suggestion is appreciated!

    order_id product_cat quantity with_electronics
    1furniture1THERE
    2grocery1N
    1Electronics1THERE

    Thank you

    Zsolt

    Hi, Zsolt,

    You can also use analytical functions.  For example:

    SELECT order_id, product_cat, quantity

    MAX (CASE

    WHEN product_cat = 'electronics '.

    THEN 'Y '.

    ANOTHER "N".

    END

    ) OVER (PARTITION BY order_id) AS with_electronics

    Orders

    ;

    Of course, I can't test it without a table.

  • To add the values in table of correspondence of IOM in reports

    Hello
    We have a requirement that we include the search values in the report. The condition is as follows:
    1. need to include the location of users in an existing report.
    2. the need to include the description of the location in the report. In our IDM, location of users are numbers as 0001, 0025, and these numbers are mapped to the decsription location in the table of research like this: Code-0001, decode-California, Code-0025, decode and Florida. We need display the location of the users as well as the description of the location in the same report codes.

    The report should look like this
    First name, name, location, description of the location
    ABC XYZ 0001 California


    If someone has implemented this type of scenario, so please let me know.


    Kind regards
    Kalpana.

    Select usr.usr_first_name, lku.lku_key, lkv.lkv_encoded, lkv.lkv_decoded in hglN hglN, lkv-lkv, usr usr
    where lku.lku_type_string_key = '. '
    and lku.lku_key = lkv.lku_key
    and usr. USR_UDF_ = lkv.lkv_encoded

  • Can add you value labels to the columns in a chart (without a custom design)?

    Is it possible to add the values for the columns in a chart to column itself without creating a custom for this column design? In this example, I represented the values in red I want will automatically appear in the data set.

    sample-column-labels.jpg

    FYI - in tutorial Lynda, Morty Golding shows a hack to do this, but it requires the creation of a custom column design. I wonder if there is a way to do it with just the default column design. Thank you!

    You need a custom column design to do this.

  • How to add the voice data on recorded voice file?

    Hello

    I'm working on control of voice (RecordControl interface) recorder in BlackBerry.
    I would like to add the voice on file already saved data.

    Is it possible to add new data on the already saved file? or any other solution to add the data of voices on the already saved the file?

    Thank you

    Sohail

    No worries mate.

Maybe you are looking for

  • What is Octoshape infinite HD?

    Hello, First of all, thank you for all answers useful or not. I can't find any recent info here on Octoshape/InfinateHD. Recently, I've rejuvenated my old MacBook (late 2009, white) for my husband who is new to Apple/Mac. While I was browsing through

  • How to import MH/content style directories in Thunderbird 24.0?

    I've been using claws-mail version 3.9.3 - 2 + b1 on Debian GNU/Linux (jessie) [amd64] that storesmessages in the folders/directories MH-style local: that is, a file for each message. I can export the contents of these directories as files MBOX-style

  • To the Bionic review

    I had the bike Bionic since February 2012 for a replacement of brand with permission, for the HTC ThunderBolt. Today, Saturday, August 18, 2012, I called Verizon to demand a resolution for a Bionic that injects data constantly, not only locally, but

  • HP chromebox: how to install on hp chromebox kodi

    can someone tell me how to install kodi app to my hp chromebox or another similar system that I can use on chromebox

  • First race in call loops

    I use 2 timed loop and a while loop in the same case statement.  When I called the case the first time, it runs as expected.  However, when I call the case subsequent times, the loops initially timed races and has indicated that there is an end loop