APEX: Delta between dates

When I ran this script

Select (LASTMODIFIED - FIRSTADDDATE) of OT_ACTION_TABLE_ORDER2;

my result is + 000000010 09:51:47.000000

I'm trying to figure out how to get the number of days.

I tried TO_DATE and some other logic and every time I get a different error.

You can lead me in the right order.

JAS-Oracle wrote:

When I ran this script

Select (LASTMODIFIED - FIRSTADDDATE) of OT_ACTION_TABLE_ORDER2;

my result is + 000000010 09:51:47.000000

I'm trying to figure out how to get the number of days.

I tried TO_DATE and some other logic and every time I get a different error.

You can lead me in the right order.

Use of the extract function:

select extract(day from (lastmodified - firstadddate)) from ot_action_table_order2;

Tags: Database

Similar Questions

  • How to search between dates (date ranges)

    Is this possible in APEX to search between dates (date ranges) records in a report page? Like "DATE between P5-DATE AND SYSDATE? Thanks in advance.

    This might work:

    SELECT secuencia_pk, nombre_accidentado, num_caso_legal, numero_reclamante,
           num_seguimiento, status, descripcion
      FROM djur_registro
     WHERE INSTR (nombre_reclamante, NVL (:p2_nombre, nombre_reclamante)) > 0
       AND INSTR (nombre_accidentado, NVL (:p2_nombre_acc, nombre_accidentado)) >
                                                                                 0
       AND INSTR (num_caso_legal, NVL (:p2_num_legal, num_caso_legal)) > 0
       AND INSTR (numero_reclamante, NVL (:p2_num_reclamante, numero_reclamante)) >
                                                                                 0
       AND INSTR (num_seguimiento, NVL (:p2_num_segui, num_seguimiento)) > 0
       AND INSTR (descripcion, NVL (:p2_descripcion, descripcion)) > 0
       AND fecha_ocurrencia BETWEEN NVL (:p2_fecha_desde, fecha_ocurrencia)
                                AND NVL (:p2_fecha_hasta, SYSDATE)
    

    Denes Kubicek
    ------------------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    ------------------------------------------------------------------------------

  • apex page modification date

    I would like to display the last date of a page has been changed as kind of a version number

    APEX knows this date (as it appears on the index page of programmer) but is there a substitution string or other access?

    ebenwalker wrote:

    I would like to display the last date of a page has been changed as kind of a version number

    APEX knows this date (as it appears on the index page of programmer) but is there a substitution string or other access?

    The modified date is available in the APEX_APPLICATION_PAGES:

    select
        last_updated_on
    from
        apex_application_pages
    where
        application_id = :app_id
    and page_id = :app_page_id
    
  • Is it possible to migrate ESXi host between data centers, if so please provide a brief not

    Hi friends,

    1. is it possible to migrate ESXi host between data centers, if so please provide a brief walking distance.

    2 can we perform vMotion and Storage vMotion while ESXi is turned on.

    3. is it possible to extend the VMDK disk while it integrates snapshots in it.

    Best regards,

    Sirot Vijay

    Yes the vmotion and svmotion works but one by one.

    1 - vmotion is posssible to power on State, but you can't svmotion the vm simultaneously. The storage will remain same

    2 svmotion is also possible to power on the State, but you cannot vmotion virtual machine simultaneously. the host will remain the same.

    3 vmotion and svmotion is possible together when the vm is off power. the host and storage can be changed simultaneously on this State.

  • Migration of VMs between data warehouses

    I added a new data store to a vSphere 5.5 infrastructure and created a few scheduled tasks to migrate under tension on the virtual machines between data warehouses.

    The migration is successful, but on the source data store, I still see a lot of files for some migrated VMs, including the .vswp and vmware files - xx.log.

    This means that the scheduled task has failed?

    What have I to do to completely move virtual machines?

    Should I turn off and turn on the virtual machine?

    Concerning

    Marius

    Maybe this file are simply zombie files, generated cause an improper shutdown of the VM (take a look at the date of creation/modification of files). You can try to rename these files, if you are able to do so, these files aren't really in use. After you rename and make sure that the virtual machine works as expected, you can manually delete the files.

  • Move VM between data on the same vCenter centers

    Hey all the...

    With a virtual machine off, I'm migrating a VM between data centers in the same vCenter. There is no shared storage, different networks to the destination host. The user interface works (caveat about the missing shows destination network), yet move-vm does not work between data centers.

    By train: move-vm - vm test-20150309 - destination esx1 datastore - datastore1, I get the error:

    Move-vm: 09/03/2015-14:48:20 Move - VM Destination container must be in the same data center.
    On line: 1 char: 1
    + move-vm - vm test-20150309 - destination esx1. ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo: InvalidArgument: (esx1:VMHostImpl) [Move-VM], VimException
    + FullyQualifiedErrorId: Client20_VmHostServiceImpl_CheckMoveVmParameters_InvalidDatacenter, VMware.VimAutomation.
    ViCore.Cmdlets.Commands.MoveVM

    The manual States -Destination can be file, host, cluster etc... As the hosts AND records are bound by data centers, I guess it must know the new host & the new folder. I tried to use - destination twice, and I've tried - destination host, folder.

    Move-VM: cannot bind parameter because the 'Destination' is specified more than once. To provide several parameter values that can accept multiple values, use the table syntax. For example, '-parameter value1, value2, value3 ".

    Move-VM: missing an argument for the parameter "Destination." Specify a parameter of type 'VMware.VimAutomation.ViCore.Types.V1.Inventory.VIContainer' and try again.

    I used PowerCLI 5.8 and tried on 5.0 and 4.0 vCenter.

    Move-vm: 09/03/2015-14:48:20 Move - VM Destination container must be in the same data center.
    On line: 1 char: 1
    + move-vm - vm test-20150309 - destination esx1. ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo: InvalidArgument: (esx1:VMHostImpl) [Move-VM], VimException
    + FullyQualifiedErrorId: Client20_VmHostServiceImpl_CheckMoveVmParameters_InvalidDatacenter, VMware.VimAutomation.
    ViCore.Cmdlets.Commands.MoveVM

    The SDK method works?

    See 3. Re: to a different vm datacenter 

  • Movimentacao between data warehouses

    Pessoal, tirem minhas questions, please:

    Preciso mover some VMs between data warehouses, para Espaço realocacao, mas o client não possui o Storage VMotion. Then devo mover na mao mesmo:

    1. Desligar o servidor
    2. Remover o servidor inventario
    3. Mover a pasta server between os data warehouses (explore data store / move directory)
    4. Readicionar o servidor ao inventario
    5. Ligar o servidor

    É ISSO, certo?

    Estava pensando numa coisa, mas não sei is da certo e be e certo fazer.

    SE EU mudasse an ambiente licença para LICENÇA (FREE) AVALIAÇÃO, dai todos os recursos ficariam habilitados, como e por padrão na versão Avaliação. The EU Dai usaria o Storage VMotion e depois colocaria a licença of volta.


    Acham as daria certo?

    Abraço,


    Sena.

    Atanagoras Sena says:

    Pessoal, tirem minhas questions, please:

    Preciso mover some VMs between data warehouses, para Espaço realocacao, mas o client não possui o Storage VMotion. Then devo mover na mao mesmo:

    1. Desligar o servidor
    2. Remover o servidor inventario
    3. Mover a pasta server between os data warehouses (explore data store / move directory)
    4. Readicionar o servidor ao inventario
    5. Ligar o servidor

    É ISSO, certo?

    Perfeito. Isso AI.

    Estava pensando numa coisa, mas não sei is da certo e be e certo fazer.

    SE EU mudasse an ambiente licença para LICENÇA (FREE) AVALIAÇÃO, dai todos os recursos ficariam habilitados, como e por padrão na versão Avaliação. The EU Dai usaria o Storage VMotion e depois colocaria a licença of volta.

    Acham as daria certo?

    Daria, very e "ilegal" você fazer isso SIM. MAS funcionaria na boa too.

    ABCs

    Don't atribuir os pontos não

  • Copia VM between data automated warehouses

    Is, I need if any can help me, I need building una tarea me Permite automatizar her copia (CLONADO) una o several VMs desde one Datastore hacía otro.

    Desde is muchas gracias

    Rolando Kohl

    Como estas?

    If cerebro scheduled task ordered realize esto, podes clonar between hasta between data centers.

    Saludos.

  • Heart rate between data centers

    Hello

    I made a VMware installation only when we have two datacenters with a host and a disk on each data center system, vi have 2 x 4 GB FC between data for the availability of the storage centers and we have 2 x 1 Gbit L2 connections between data (network, vmotion and HB) centers.

    Now my problem is pulsation HA making only redundant you normally just add two natachasery to the switch, but in my case I need to run my heart rate on two different VLANS to ensure that it also works on different connections between data centers.

    If I just add another service console and configure a new vlan with default gateway, dose anyone know if it will work?

    Daniel

    Hi Daniel,.

    Welcome to the forums.

    You can take a look at the following KB on the Service Console redundancy for VMware High Availability.

    It will be useful.

    Concerning

    Franck

  • Clone between data centers and through the firewall?

    I have a VC that manages 8 virtual data centers.  Some of these data centers are on a dish network, and some are in a demilitarized zone.  Even if the storage is NOT shared between data centers, I am able to clone a VM between data on food networks centers but I cannot clone between a data center on a dish network and the other in a demilitarized zone.

    Is there a specific port that must be open to clone through a firewall, or I wouldn't be able to do this.

    ________________________________

    Jason D. Langdon

    The file copy occurs using port TCP/UDP 902, as all communications from ESX.

    Do you have any NAT between the servers ESX and vCenter?

    Marcelo Soares

    VMWare Certified Professional 310/410

    Master virtualization technology

    Globant Argentina

    Review the allocation of points for "useful" or "right" answers.

  • code succcessive to genereate difference between dates in a table

    First create and insert statements;
    create table schedule(iloan_code number , schedule_date date);
    
    insert into schedule values(1001, to_date('01-jun-2012'));
    insert into schedule values(1001, to_date('01-jul-2012'));
    insert into schedule values(1001, to_date('01-aug-2012'));
    insert into schedule values(1001, to_date('01-sep-2012'));
    insert into schedule values(1001, to_date('01-oct-2012'));
    commit;
    The output of the table of the ANNEX should be now like this:
    ILOAN_CODE     SCHEDULE_DATE
    1001              01-JUN-12
    1001              01-JUL-12
    1001              01-AUG-12
    1001              01-SEP-12
    1001              01-OCT-12
    We want an additional column by name as well as the existing columns DAYS that would be the difference between dates.

    First line should be the difference between sysdate as well as the date of June 1, 2012 and successive lines must be the difference between successive calendar date

    For example in the second row the DAYS column should represent the difference between 1 July 2012 and 1 June 2012 and so on for the following ranks too.

    We need get the result by a SELECT statement

    The output of the table in the ANNEX must be something like that.
    iloan_code      schedule_date     days     Logic which we need 
    1001     1-Jun-12     22     sysdate-1st June 2012
    1001     1-Jul-12     30     difference between 1st July 2012 and 1st June 2012
    1001     1-Aug-12     31     difference between 1st aug 2012  and 1st July 2012
    1001     1-Sep-12     31     difference between 1st sep  2012 and 1st aug  2012
    1001     1-Oct-12     30     difference between 1st oct 2012 and 1st sep 2012
    Please notify;

    Hello

    You can change the Hoek solution like this:

    SELECT    iloan_code
    ,             schedule_date
    ,             schedule_date - LAG ( schedule_date
                                , 1
                         , TRUNC (SYSDATE)
                         ) OVER (ORDER BY schedule_date)     AS days_between
    FROM      schedule
    ORDER BY  schedule_date
    ;
    

    If all schedule_dates will be after SYSDATE, then you need not the CASE expression to test if it is.
    The argument optional 3rd to LAG is a return value in case there is no previous line.

    Sri says:
    ... The output of the table in the ANNEX must be something like that.

    iloan_code      schedule_date     days     Logic which we need
    1001     30-Jun-12     07     sysdate-30June 2012
    1001     1-Jul-12     30     difference between 1st July 2012 and 30 June 2012 ...
    

    The difference between 30 June 2012 and July 1, 2012 is not only 1 day?

  • Days between dates based on a 360-day calendar (10g)

    Hello
    does anyone know how to calculate days between dates based on a 360-day calendar (12 months to 30 days, used by merchants)? I use Oracle 10 g.

    Thank you for the help
    Best regards
    Carsten
    SQL*Plus: Release 10.1.0.4.2 - Production on Thu May 26 10:28:15 2011
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Beta
    
    ANTON@XE>with t as (
      2    select date '2011-04-04' as date_to, date '2011-02-02' as date_from from dual union all
      3    select date '2011-04-01', date '2011-02-02' from dual union all
      4    select date '2011-03-18', date '2011-02-02' from dual union all
      5    select date '2011-02-04', date '2011-02-02' from dual union all
      6    select date '2011-02-01', date '2011-01-31' from dual union all
      7    select date '2011-02-02', date '2011-02-02' from dual
      8  )
      9  select date_from, date_to
     10       , least( extract( day from date_to ), 30 ) - least( extract( day from date_from ), 30 )
     11       + 30 * ( extract( month from date_to ) - extract( month from date_from ) )
     12       + 360 * ( extract( year from date_to ) - extract( year from date_from ) ) days360
     13  from t
     14  /
    
    DATE_FROM       DATE_TO            DAYS360
    --------------- --------------- ----------
    02-FEB-11       04-APR-11               62
    02-FEB-11       01-APR-11               59
    02-FEB-11       18-MAR-11               46
    02-FEB-11       04-FEB-11                2
    31-JAN-11       01-FEB-11                1
    02-FEB-11       02-FEB-11                0
    
    6 rows selected.
    
    ANTON@XE>
    

    See also http://en.wikipedia.org/wiki/360-day_calendar

  • How to get LASTDAY for each month between data dates...

    Hi friend

    I have a doubt, how to get LASTDAY for each month between data dates...

    for ex:
    My contribution will be like this
    date = 01/12/2011
    To date = 14/04/2011

    And I need an output like
    31/01/2011
    28/02/2011
    31/03/2011

    is it possible to achieve through sql query in oracle
    Thanks in advance for all friends to help him

    Hello

    Something like this (assuming that the dates are originally VARCHAR2s):

    SQL> var dt_start varchar2(10)
    SQL> var dt_end varchar2(10)
    SQL> exec :dt_start := '12-01-2011'
    
    PL/SQL procedure successfully completed
    
    SQL> exec :dt_end := '14-04-2011'
    
    PL/SQL procedure successfully completed
    
    SQL>
    SQL> select last_day(
      2           add_months(
      3             trunc(to_date(:dt_start,'DD-MM-YYYY'),'MM'),
      4             level-1
      5           )
      6         ) as result
      7  from dual
      8  connect by level <= months_between(to_date(:dt_end,'DD-MM-YYYY'), to_date(:dt_start,'DD-MM-YYYY'))
      9  ;
    
    RESULT
    -----------
    31/01/2011
    28/02/2011
    31/03/2011
     
    

    If the dates are already of the date data type, simply remove the to_date function.

  • Search between Dates

    It's confusing, so I'll do my best to explain.

    We have an application where employees sign out of the office. They provide it userID, LeaveDate and ReturnDate and it is written in a single record in SQL.

    There are also several searches for this data, which is to enter a user name and two dates and return if this user is disconnected between these two dates if the LeaveDate is now between the two search dates.

    The problem is that if someone was taken out of the 8 to 15, and a search was made on them for the 11th to the 13th, he would not return anything that either since the (8th) LeaveDate do not fall between the two search dates.

    So now, I am loaded with a way to solve this problem. Is there a search between dates and determine whether any date within this range is in the range of dates that the employee is disconnected? Is it possible, when the employee signs, create a record for each date in the span of days they have disappeared? So if someone out of the 10th to the 12th, it would create three different entries.

    Any help is appreciated.

    > return if this user is disconnected between these two
    > dates if the LeaveDate is between the
    > search two dates

    Start by creating some examples of date that will cover all the possibilities. As

    If the dates of research are:

    Search Start = 11
    End of search = 13

    You want to include these cases

    1 Date1 is before you start to search for... AND. Date2 is between start and end search
    Example: 6 to 13

    2 Date1 is between start and end search... AND... Date2 is after end search
    Example: 9th and 17th

    3 Date1 is between start and end search... AND... Date2 is between start and end search
    Example: 7-12

    4 Date1 is before you start to search for... AND... Date2 is the result of research
    Example: 5-21

    Then translate these terms to sql and test with some sample values. If your fields contain dates that comparisons are simple. If they contain a date and time don't forget to report both in your comparisons.

    There are better ways to write this, but here's an example of how you might begin to translate the above 4 conditions. Once you have the job of the initial query, you can improve the sql.

    Pseudo-CF/SQL

    WHERE (Date1< #start#="" and="" date2="" between="" #start#="" and="" #end#="">
    OR (Date1 BETWEEN #Start # AND #End # AND Date2 > #End #)
    OR (Date1 BETWEEN #Start # AND #End # AND Date2 BETWEEN #Start # AND #End #)
    OR (Date1 < #start#="" and="" date2=""> #End #)

  • get delta days between dates

    Im trying to get the days between off_date and the following on_date for a user. (in the real of the table plenty of users with dates).

    Here is an example of the data.

    Oracle 11.2.0.3.0

    CREATE TABLE TEST_USER)

    NUMBER OF U_ID

    PERSON_NAME VARCHAR2 (50).

    ON_DATE DATE,

    date of off_date

    );

    INSERT IN TEST_USER (U_ID, PERSON_NAME, ON_DATE, OFF_DATE) VALUES (1, 'bob jones', TO_DATE (' 01/01/2013 ',' mm/dd/yyyy'), TO_DATE (' 01/10/2013 ',' mm/dd/yyyy'));

    INSERT IN TEST_USER (U_ID, PERSON_NAME, ON_DATE, OFF_DATE) VALUES (2, 'bob jones', TO_DATE (' 01/18/2013 ',' mm/dd/yyyy'), TO_DATE (' 01/27/2013 ',' mm/dd/yyyy'));

    INSERT IN TEST_USER (U_ID, PERSON_NAME, ON_DATE, OFF_DATE) VALUES (3, 'bob jones', TO_DATE (' 02/01/2013 ',' mm/dd/yyyy'), TO_DATE (' 01/03/2014 ',' mm/dd/yyyy'));

    INSERT IN TEST_USER (U_ID, PERSON_NAME, ON_DATE, OFF_DATE) VALUES (4, 'bob jones', TO_DATE (' 02/01/2014 ',' mm/dd/yyyy'), TO_DATE (' 02/02/2014 ',' mm/dd/yyyy'));

    insert into test_user (person_name, on_date, u_id, off_date) values (5, 'bob jones', to_date('02/02/2014','mm/dd/yyyy'), to_date (' 02/03/2014 ',' mm/dd/yyyy'));

    output should be:

    Bob jones 8 days

    Bob jones 5 days

    etc...

    Therefore the days between off_date and the next on_date

    Thank you.

    Hello

    Here's one way:

    SELECT person_name

    , (LEAD (on_date) OVER (PARTITION BY person_name - just guessing)

    ORDER BY on_date

    )

    -off_date

    ) || 'days' LIKE days

    OF test_user

    ;

    I guessed at what person_name role in this problem, and what is unique.

Maybe you are looking for