How to add two time values in oracle

Hi, I have two time as parameters: pSTTIME and: pETTIME is defined as a VARCHAR2 column type

I have values for: pSTTIME as 09:00 and: like 15:30 pETTIME

How to add these two times, I tried with TO_TIMESTAMP and TO_CHAR, I tried also with SUM but he failed in all situations

can anyone help

Hello

TO_NUMBER allows to convert numbers that you can add these channels.
Use TO_CHAR convert that number into a string.

In PL/SQL:

minutes := ( ( TO_NUMBER (SUBSTR (:psttime, 1, 2))
          + TO_NUMBER (SUBSTR (:pettime, 1, 2))
          )
        * 60
        ) + TO_NUMBER (SUBSTR (:psttime, 4, 2)
          + TO_NUMBER (SUBSTR (:pettime, 4, 2);
str := TO_CHAR (TRUNC (minutes / 60))
    || ':'
    || TO_CHAR ( MOD (minutes, 60)
                   , 'fm00'
            );

In SQL, calculate the NUMBER minutes in a subquery, so you can use the alias in a Super application.

This assumes that: psttime and: pettime are always well trained: 2 digits for the hours, a colon, then 2 digits for the minutes. If you are unsure of the number of digits, the same basic app will work, but the SUBSTRs will be a little more complicated.

I hope that answers your question.
If this isn't the case, after a complete test script that people can run to recreate the problem and test their ideas. Include the VARIABLE, CREATE TABLE, INSERT, or any statement is necessary to provide some examples of data and also after the output you want from this sample data.

Tags: Database

Similar Questions

  • How to add two times together?

    I'm trying to get the result of once added to a time difference to calculate the result. How is that possible?

    Hi SimonJohnD,

    Numbers of tent to make this easy. There may be unexpected results. First of all remember that number once is always associated with a date. So when I type '05:30 ' today the value in the cell is ' 12/01/2016 05:30 '. When I type '2 h' numbers includes it is lasting.

    Looking for more than that?

    Quinn

  • How to add the full value of two buttons?

    How to add the full value of two buttons (any key) VI and display it in the output text box? I am attaching a sample program, but I know that his evil... Help, please

    Try this

  • How to add two lines when the second row is not visible, but also gets the first data line too?

    Mr President

    Jdev worm is 12.2.1

    How to add two lines when the second row is not visible, but also gets the first data line too?

    I want to add two lines like below picture, but want the second to remain invisible.

    tworows.png

    I asked this question but my way of asking was wrong, that's why for me once again.

    Concerning

    Try to follow these steps:

    1. in the database table to add the new column "JOIN_COLUMN" and add the new sequence "JOIN_SEQ".

    2. Add this new column in the entity object. (You can add this in entity object by right clicking on the entity object and then select "Synchronize with database" then the new column and press on sync)

    3. in your bookmark create button to create only one line NOT 2 rows.

    4 - Open the object entity--> java--> java class--> on the entity object class generate and Tick tick on the accessors and methods of data manipulation

    5 - Open the generated class to EntityImpl and go to the doDML method and write this code

      protected void doDML(int operation, TransactionEvent e)
      {
        if(operation == DML_INSERT)
        {
          SequenceImpl seq = new SequenceImpl("JOIN_SEQ", getDBTransaction());
          oracle.jbo.domain.Number seqValue = seq.getSequenceNumber();
          setJoinColumn(seqValue);
          insertSecondRowInDatabase(getAttribute1(), getAttribute2(), getAttribute3(), getJoinColumn());
        }
    
        if(operation == DML_UPDATE)
        {
          updateSecondRowInDatabase(getAttribute1(), getAttribute2(), getAttribute3(), getJoinColumn());
        }
    
        super.doDML(operation, e);
      }
    
      private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object joinColumn)
      {
        PreparedStatement stat = null;
        try
        {
          String sql = "Insert into table_name (COLUMN_1,COLUMN_2,COLUMN_3,JOIN_COLUMN, HIDDEN_COLUMN) values ('" + value1 + "','" + value2 + "','" + value3 + "','" + joinColumn + "', 1)";
          stat = getDBTransaction().createPreparedStatement(sql, 1);
          stat.executeUpdate();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        finally
        {
          try
          {
            stat.close();
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
    
      private void updateSecondRowInDatabase(Object value1, Object value2, Object value3, Object joinColumn)
      {
        PreparedStatement stat = null;
        try
        {
          String sql = "update table_name set column_1='" + value1 + "', column_2='" + value2 + "', column_3='" + value3 + "' where JOIN_COLUMN='" + joinColumn + "'";
          stat = getDBTransaction().createPreparedStatement(sql, 1);
          stat.executeUpdate();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        finally
        {
          try
          {
            stat.close();
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
    
  • How to add a time system of the document?

    How to add a time system of the document?

    I tried to edit this script, but probably wrong with the command...

    var f = this.getField ("Today");

    f.Value = util.printd ("mm/dd/yyyy", new Date());

    Change this part of the code:

    util.printd ("mm/dd/yyyy", new Date());

    TO:

    util.printd ("HH: mm", new Date());

  • How to add two values

    How to add varchar values in oracle. Consider that both are times values.but [both] data type is varchar and stroed table

    For example:

    Column1 Column2
    2.40: 10 05:22

    I need the result to the following format
    8.02 [8 hours and 2 minutes]

    user12059276 wrote:
    How to convert this format

    Assuming that the result is less than 24 hours:

    select to_char(trunc(sysdate) + interval '2:40:10' hour to second + interval '5:22:00' hour to second,'HH24:MI') dt
      from dual
    /
    
    DT
    -----
    08:02
    
    SQL> 
    

    SY.

  • How to add a time stamp to a PDM file

    I need to add a time stamp to my PDM file.  Currently, I take an array of doubles, their conversion to a type of dynamic data, then send to tdms_write.  I have to add a timestamp, but I can't find a way to do it.  I also tried holding the timestamp, converting it into a doube, U64 and I64 and adding that to my table before the dynamic data conversion type, but when I lose precision.  I need to have at least millisecond resolution.  I know that I lose accuracy because the timestamp is two 64-bit values.  top 64-bit are set to seconds since the epoch and lower 64 bit are fractions of a second.  I would even send these two numbers divided in my happy tdms file and conversion at a later date, but can't seem to do it again.  Any help would be appreciated.

    The natural way would be using a waveform.

    You can add your timestamp as two U64 (using cast to array U64) as properties of the channels as data t0.

    Tone

  • How to add two columns in the criteria (OBIEE 11 g)

    Hello

    I try to add two columns in a criterion of obiee

    * "Done - OLB processed invoices. "" Invoice amount - currency "__" made - OLB processed invoices "." " The amount of taxes AR - billing currency"

    but the problem is:-
    The first column have 500000000 and the second column contains some NULL values from the table. I think that this could be the problem when I try to add that it gives no output.
    just an empty box.

    Can someone tell me how we can add columns in this State.

    Thank you to each and every one.

    Try IFNULL (expr, value)
    for the other columns

    "Done - OLB processed invoices". " Charge the amount - currency "+ IFNULL (" made - OLB processed invoices "". ")" AR tax - currency billing", 0)

    Published by: Srini VIEREN on March 20, 2013 10:02

  • How to add columns with values of each folder?

    Hello

    I am a novice to the Disqualification and here my question:

    I want to be able to add the number of columns in the "not null" by registration, as compared to a reference table and return a value.

    For example:

    Article-1

    Agenda Value-1 Value-2 Value-3 Value-4 Value-5
    Article-1blah blahblah blah blahbla
    point-2blah2blah3

    In this example, the "point-1' has 3 columns populated so I'll compare against my reference data that dictates the number of columns MUST it have completed.» Whether all withdrew, point passes through, but if she does not meet the minimum requirements, it is reported.

    I tried to use the "No. Data Check" tool, which report on the null columns, but I can't understand how to add.

    Thanks for the help!

    In this case, i.e. If you want different thresholds for different records, use a set of baseline mapping family (string) and threshold (number) and use Enhance card on this reference data set to add the value of threshold appropriate to each record data before using the attribute cross check to compare the threshold against the real value.

  • How to add two controls on the same form datagrid? I get the error message...

    Hello

    I have to add two controls on the same page datagrid. When I try to drag an another DataGrid in the components window, it says "an element with that name already exists in the library."

    How can I add multiple controls on the same page datagrid?

    Kind regards.

    _data2 = new XML (event.target.data2);

    should be

    _data2 = new XML (event.target.data);

    (actually, it's better if it was

    _data2 = XML (event.target.data);

  • How to add commas in values

    Nice day

    I created the report and the displayed value not have commas in values such as "3,20,000", my values are displayed as '320000.
    How to add commas in the apex.


    Kind regards
    OMZ

    Hello

    Version of the apex?
    Classic report / IR?

    Try to set the attributes of report > Edit Column > column attributes > number / Date Format

    See you soon,.

  • How to add two fields and show the result in a third

    All,
    I have 2 InputText field; both are related to the fields of the associated database.

    I want to display the sum of these two fields on a text output.

    I declare the value of the output in this way text link:
    #{sessionScope.PersonalNrBean.summeDB.value + sessionScope.PersonalNrBean.kmGeldMlp.value}

    But I get this error:
    Cannot find resource for bundle java.util.PropertyResourceBundle, key el.convert

    ADF_FACES - 60097:Weitere desKomitees find DEM Fehlerlog einen entry as servers, der mit: ADF_FACES - 60096:Server - Exception while PPR, beginnt #3

    If I declare the value binding to contain the field even two times:
    #{sessionScope.PersonalNrBean.summeDB.value + sessionScope.PersonalNrBean.summeDB.value}
    It works as expected, but it's not really what I need...

    Any ideas?

    Thanks in advance,
    Sergio.

    Edited by: user5414451 the 14.07.2011 02:57

    Try following:

    #{bindings.summeDB.inputValue.value + bindings.kmGeldMlp.inputValue.value}
    

    Jean Lou

  • How to add the default value for the "Full - Text Search" box

    Hi all

    I am looking for the ability to add a default value for the "Full text search" box in the search form.

    Example:

    When the user accesses the search page it get default values for some fields (defined in the rule as default values) such as

    xField1 = txt1 and xFiel2 = txt2.

    and Furthermore we need full-text = Hello world.

    Is this possible?

    Another way that we use is to open the search by URL with coreContentOnly = 1 as a form:

    http:// < Server >/cs/idcplg? IdcService = GET_DOC_PAGE & to Action = GetTemplatePage & to Page = STANDARD_QUERY_PAGE & coreContentOnly = 1 & to xField1 = txt1 & to xFiel2 = txt2

    It is possible to add full-text criteria here? Somethig like: & text = Hello World

    Thank you

    Leon

    It is not possible in a very obvious way, not to mention that it is a rather strange request.  I can't really imagine a realistic use for this case.

    Anyway, without a messy customization, you should provide a default query with an FTX inside element text setting (i.e. "IdcService = GET_DOC_PAGE & Action = GetTemplatePage & Page = STANDARD_QUERY_PAGE & QueryText =Hello World" "")

    To do this in a profile in the secondary effects of the profile section, add the following:

    <$dpPromote("QueryText",>Hello everyone") $>.

  • How to store a timer value

    Hi guys, im fairly new to all this labview, so I apologize if this is a silly question, im using an elapsed timer, I got a signal when it is greater than a constant, it resets the timer that gives a value of 0 for a defiler, when the signal is in the range the timer shows time elapsed ontill the signal falls out of scope indicating 0 new ,

    If im trying to get the last value before reset has been exacuted, or more time between the two, so that I can send the value for futher as RPM calculations

    Thanks for the tips!

    my head hurts!

    Hi Vadajooz,

    You can use the convert to Dynamic data VI and configure it to convert a single scalar value. This will give you a floating point number that you can enter for the comparison group.

    Kind regards.

  • How to add the time format 24 hours to the component convertDate and time?

    Hello

    I created a text input, then drag convertdate and time component on this once I've defined the type = "time".

    I need how to get 24-hour format when I enter values in input text box.

    If you use af:convertDateTime, you can provide a model like this: model = 'HH '.

Maybe you are looking for