Create lines based on the difference in date

Hello

I would like to create lines based on the difference between the start and end dates (per year).

for example

ID1  Start_time                                             End_time                                                      ID2
07/01/2003 1, 12.00.00.000000000 2005-01-07 12.00.00.000000000 123

07/01/1999 1, 12.00.00.000000000 07/01/2003 12.00.00.000000000 345

I need:

ID1  Start_time                                             End_time                                                      ID2
07/01/2004 1, 12.00.00.000000000 2005-01-07 12.00.00.000000000 123

07/01/2003 1 12.00.00.000000000 07/01/2004 12.00.00.000000000 123

1 01/07/2002 12.00.00.000000000 07/01/2003 12.00.00.000000000 345

07/01/2001 1, 12.00.00.000000000 01/07/2002 12.00.00.000000000 345

07/01/2000 1, 12.00.00.000000000 01/07/2001 12.00.00.000000000 345

07/01/1999 1, 12.00.00.000000000 07/01/2000 12.00.00.000000000 345

Thank you

Hello

Here's one way:

SELECT ID1

, ADD_MONTHS (start_time, 12 * (LEVEL - 1)) AS start_time value

, ADD_MONTHS (start_time, 12 * LEVEL) AS end_time

id2

FROM table_x

CONNECT BY LEVEL<= months_between="" (end_time,="" start_time)="">

AND PRIOR id2 = id2

AND PRIOR SYS_GUID () IS NOT NULL

;

I'm assuming that id2 is unique.

Would what results you if end_time wasn't exactly N years after start_time?

Tags: Database

Similar Questions

  • Failed to create line breaks in the pre-filled data!

    I want to have line breaks in my pre-filled data with livecycle "tab > value tab > Default" box does not seem to allow line breaks. Well, I tried to go about with the help of scripts

    this.rawValue = "bleh."

    Bleh

    bleh.

    This method works very well, but I have noticed that according to that case I insert the code, either I'm not allowed to make changes to the text or any change is rejected when I save the file, close, and then reopen it.  Is there a way to solve this issue using either the script or the box default adobe designed for pre-filling?  Thank you all.

    -gollum

    Yes, any changes to the text will overwrite the default value specified in the XML file.

  • Generating lines based on the value of the column?

    Hi all

    I would like to know if there is a function that can help me in creating lines based on a column value and, if so, which. I'm on version 11.2.0.3.0

    for example, I have these data in the table:
    ID O A C
    1 5 3 5
    2 9 2 3

    Where ID is an identifier unique record and column C contains the number of records, I would have returned for this ID. In this example, the folder with the ID 1 would be repeated 5 times and the folder with the id 2 would be repeated 3 times. The result would look like this:

    ID O A C
    1 5 3 5
    1 5 3 5
    1 5 3 5
    1 5 3 5
    1 5 3 5
    2 9 2 3
    2 9 2 3
    2 9 2 3

    Column C contains the number of repetitions Records and is defined as a positive integer > = 1.

    Of course, in real life, the table contains (at this time) 41 M number of records and the value of C can vary between 1 and 554, hardcode on the example above values is not possible.

    Any pointers in the right direction are much appreciated.

    Kind regards
    Lennert
    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 1 as id, 5 as c from dual union all
      2             select 2, 3 from dual)
      3  --
      4  select id, c
      5  from   t
      6  connect by level <= c
      7          and id = prior id
      8*         and prior sys_guid() is not null
    SQL> /
    
            ID          C
    ---------- ----------
             1          5
             1          5
             1          5
             1          5
             1          5
             2          3
             2          3
             2          3
    
    8 rows selected.
    
  • How to get the values based on the most recent date

    Oracle Version 8i



    How to get the new_value based on the most recent date

    SELECT max (MODIFIED_ON), the Group LOG_ITEM_CHARACTERISTICS by MODIFIED_ON new_value - does not

    Please, someone help me
    CREATE TABLE LOG_ITEM_CHARACTERISTICS
    (
      CHAR_LOG_ID          NUMBER(10)               NOT NULL,
      PIRM_ID              VARCHAR2(8)              NOT NULL,
      CONSTANT_FLAG        VARCHAR2(1),
      CHARACTERISTIC_NAME  VARCHAR2(25)             NOT NULL,
      TYPE_NAME            VARCHAR2(10)             NOT NULL,
      NEW_VALUE            VARCHAR2(3000),
      UOM                  VARCHAR2(10),
      MODIFIED_BY          VARCHAR2(30),
      MODIFIED_ON          DATE
    )
    
    SET DEFINE OFF;
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (187376, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '1', 'AMPS', 'EMPXD88', TO_DATE('10/25/1999 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (187377, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMPXD88', TO_DATE('09/22/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (187378, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '0', 'AMPS', 'EMDXB88', TO_DATE('09/22/1998 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (187384, '0307490N', 'N', 'OUTPUT CURRENT', 'PS2030/WVL', '2', 'AMPS', 'EMAXC29', TO_DATE('11/10/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (187385, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55.1', 'VOLTS', 'EMAXC29', TO_DATE('10/19/2001 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_ON)
     Values
       (2400742, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '2', 'AMPS', TO_DATE('10/19/2001 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (574093, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '2', 'AMPS', 'EMCTH88', TO_DATE('12/13/2002 11:55:16', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (574094, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMCTH88', TO_DATE('12/13/2002 11:55:16', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (3131486, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (3131487, '0307490N', 'N', 'LAST MEASURED DATE', 'PS2030/WVL', '16-12-04', 'DD/MM/YY', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (3131488, '0307490N', 'Y', 'POWER SUPPLY', 'PS2030/WVL', 'ESSENTIAL', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (3131489, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMCTH88', TO_DATE('12/16/2004 14:31:14', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (4759086, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (4759087, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '54.9', 'VOLTS', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (4759088, '0307490N', 'N', 'LAST MEASURED DATE', 'PS2030/WVL', '14/11/07', 'DD/MM/YY', 'EMRCT88', TO_DATE('11/15/2007 14:33:03', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646012, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '5', 'AMPS', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646013, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646014, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646015, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646016, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 12:56:17', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646057, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646058, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6646059, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'null', 'PAUL DEVERILL', TO_DATE('01/06/2011 13:03:18', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648577, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '6', 'AMPS', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648578, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648579, '0307490N', 'Y', 'YR ROUTINES REQUIRED', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:35:45', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648580, '0307490N', 'Y', 'BATT TEST SET AT 3M', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:36:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648581, '0307490N', 'Y', 'CAP ALARM INHIBITED', 'PS2030/WVL', 'NULL', 'EMPXD88', TO_DATE('01/07/2011 13:36:10', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648634, '0307490N', 'N', 'MEASURED LOAD ON PER', 'PS2030/WVL', '5', 'AMPS', 'EMPXD88', TO_DATE('01/07/2011 13:51:06', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into LOG_ITEM_CHARACTERISTICS
       (CHAR_LOG_ID, PIRM_ID, CONSTANT_FLAG, CHARACTERISTIC_NAME, TYPE_NAME, NEW_VALUE, UOM, MODIFIED_BY, MODIFIED_ON)
     Values
       (6648635, '0307490N', 'N', 'OUTPUT VOLTAGE', 'PS2030/WVL', '55', 'VOLTS', 'EMPXD88', TO_DATE('01/07/2011 13:51:06', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;

    user4587979 wrote:
    Hi Frank

    Yes, but I had more than 2 tables with item_characteristics, type_characteristics

    If there are other tables involved, then CREATE TABLE and INSERT statements for them (for the relevant columns only). You must not post a lot of examples of data; usually just a couple of lines per table is enough to show the problem.
    Also post the results desired from these data.

    What I try to do is, I'm comparing new_value in log_item_characteristics (whichever is most recent) with CHR_VALUE in the item_characteristics and the needs of different output values

    I am trying to query is not giving desired out put

    Point out some places where the output is wrong and explain how you get good results in these places, using specific examples from the data sample.

    select  lic.PIRM_ID, ic.CHR_ID, lic.CHARACTERISTIC_NAME,
    lic.TYPE_NAME, ic.CHR_VALUE, lic.NEW_VALUE,  lic.MODIFIED_BY,  lic.MODIFIED_ON,
    ic.CREATED_BY, ic.CREATED_ON,ic.MODIFIED_BY, ic.MODIFIED_ON
    from log_item_characteristics lic, item_characteristics ic,type_characteristics tc  where
    lic.TYPE_NAME=tc.TYPE_NAME
    and lic.CHARACTERISTIC_NAME=tc.CHR_NAME
    and lic.PIRM_ID=ic.PIRM_ID
    and tc.CHR_ID=ic.CHR_ID and ic.CHR_VALUE <> lic.NEW_VALUE
    and lic.pirm_id in ('0307490N','0307521C')
    order by lic.pirm_id
    

    Thank you; It is useful to see the existing query. Really, you have to format your code.

    Please can you help me

    What you've posted so far is like saying "I'm going 200 meters to the North, and then 500 meters East, but I'm not getting where I want to go." I would have a better chance to help you if you said, 'I'm out of my house, at 100, Elm Street and try to get to the supermarket at Broadway 279. I'm going 200 meters to the North... ', or, even better. "I want to buy a newspaper and some orange juice, so I thought I'd go to a convenience store. I start at my house, at 100, Elm Street... »
    Always post some examples of data (CREATE TABLE and INSERT statements, as you did in your first post) and the desired results from these data. Explain how you get these results from these data.

  • Hide a line based on the State.

    Hello, I have a requirement where I have to hide a line based on the State. I am able to highlight the lines but hide the entire line does not work.

    Condition must be met on a line:

    • Thus, if a sum of EXP5_11, EXP6_11, EXP7_11 and EXP8_11 in a current group is all zeros hide this line. Please refer to the RTF-model.

    Attachments:

    • RTF-model.
    • XML file.
    • Sample output generated when the lines are highlighted the meeting status.

    Any help is much appreciated on how I can hide a line.

    EM-: [email protected]

    If please remove your IF condition and add the following code inside the foreach tag

    This works very well in my test.

  • assign the number to a line based on the analytical condition function

    Oracle 11g Server

    ID val1 val2
    100a
    110 b
    120c
    200a
    220 b

    WITH input AS
     (SELECT 1  id
            ,0  val1
            ,'0a' val2
        FROM dual
      UNION ALL
      SELECT 1  id
            ,1  val1
            ,'0b' val2
        FROM dual
      UNION ALL
      SELECT 1  id
            ,2  val1
            ,'0c' val2
        FROM dual
      UNION ALL
      SELECT 2  id
            ,0  val1
            ,'0a' val2
        FROM dual
      UNION ALL
      SELECT 2     Id
            ,2val1
            ,'0b'    val2
        FROM dual)
    SELECT * FROM input;
    
    !-[CodeBlockEnd:ae52826b-04c5-4aa4-a6c0-1d0405656e55]-->

    Output:

    ID val1 val2 assigned_number
    100a0
    110 b0
    120c2
    200a0
    220 b1

    The dense numbering sequence must be assigned to each line based on the column id and val1.

    For an identifier given, the numbering begins only after val1 > 1 until then the assigned_number will be zero.

    WITH the entry INTO

    (SELECT 1 id)

    0 val1

    '0' has val2

    OF the double

    UNION ALL

    SELECT 1 id

    1 val1

    b '0' val2

    OF the double

    UNION ALL

    SELECT 1 id

    2 val1

    , 0'c ' val2

    OF the double

    UNION ALL

    SELECT 2 id

    0 val1

    '0' has val2

    OF the double

    UNION ALL

    SELECT the Id 2

    2val1

    b '0' val2

    THE DOUBLE)

    SELECT id, val1, val2,

    Rank() over (partition by order of case when val1 > 1 then 0 otherwise end val1) dr-1

    SINCE the entry;

    ID VAL1 IS DR

    ---------- ---------- -- ----------

    1          0 0a          0

    1          1 0b          0

    1          2 0c          2

    2          0 0a          0

    2          2 0b          1

  • Bookmarks created automatically based on the word 2013 Table of contents.

    Bookmarks created automatically based on the word 2013 Table of contents.  In the earlier version of Word, the Style of the Table of contents built into bookmarks when PDFing.

    I thought about it.  There is a new check box, you must activate in 2013 of Word when exporting to PDF format that allows to convert the elements of bookmarks when PDFing.

  • When you save a file to the [.jpg] format, I wonder to choose a quality from 1 to 100. What are the changes in the created file based on the selected quality setting?

    When you save a file to the [.jpg] format, I wonder to choose a quality from 1 to 100. What are the changes in the created file based on the selected quality setting? I would like to know what changes, so in the future, I can set my camera to one who will give me the highest quality in a first time, which allows me to make cultures and always preserve the quality.

    Thank you

    Dovid

    Thank you twenty-one... your answer of common sense to me.

    so, in short, can I assume down the chosen quality over compression algorithm?

  • How to find the difference in date in years, months and days

    Hello
    I need to find the difference between 2 dates in the following way "years months days". "
    Please can help me, how can I achieve this.

    for example, in the scott schema emp table, I need to find the difference in date between sysdate and hiredate for an employee in the following way.

    12 years 7 months 4 days.

    Hello

    Please, see this post to AskTom [difference between 2 dates | http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:96012348060]. There is good information in this forum, for example you can also see this thread [calculation of years, months & days | http://forums.oracle.com/forums/thread.jspa?messageID=3115216�]

    Kind regards

    Published by: Walter Fernández on November 30, 2008 08:58 - adding another link

  • insert into the table based on the difference in line (or using less)

    Hello

    Oracle Version: 11g

    Operating system: Solaris 10.

    I was wondering if it is possible to insert data in a table based on the operator 'less' Please?

    We have a very large table in a database, we moved to a different database. The table is cleared by a line for a certain range of dates, and we wondered if it is possible to insert this line of data in the remote database using the difference of rank between the two tables.

    Here's the query that we are running:

    SELECT ID , TO_CHAR (creation_datetime, 'yyyy-mm-dd')
    from TABB10 
    where TO_CHAR (creation_datetime, 'yyyy-mm-dd')='2014-03-18' 
    minus 
    SELECT ID , TO_CHAR (creation_datetime, 'yyyy-mm-dd')
    from TABB10@TABB_LINK.APDB00 
    where TO_CHAR (creation_datetime, 'yyyy-mm-dd')='2014-03-18'
    

    TO_CHAR (CR ID

    ---------------------- ----------

    2.4111E + 17-18 / 03 / 2014

    Any ideas please?

    Thank you

    If I don't get me wrong, you can insert as below

    INSERT INTO REMOTE_TABLE@DBLINK

    SELECT ID, TO_CHAR (creation_datetime, "yyyy-mm-dd")

    of TABB10

    where TO_CHAR (creation_datetime, 'yyyy-mm-dd') ='' 2014-03-18

    less

    SELECT ID, TO_CHAR (creation_datetime, "yyyy-mm-dd")

    of TABB10@TABB_LINK. APDB00

    where TO_CHAR (creation_datetime, 'yyyy-mm-dd') ='' 2014-03-18

    Concerning

  • Query SQL to split the lines based on the amount

    I have the data in the following format in the table.

    ORDER_ID PRODUCT_ID QUANTITY

    O1 A1   3

    I need to write the sql query to divide the data in following format:

    ORDER_ID PRODUCT_ID QUANTITY

    O1 A1   1

    O1 A1   1

    O1 A1   1

    Query must split the data based on the value in the quantity column.

    Thank you

    Developer

    Hello

    create table order_items (
      order_id varchar2(2),
      product_id varchar2(2),
      quantity number
    )
    ;
    insert into order_items values ('O1', 'A1', 3)
    ;
    -- Recursive Subquery Factoring
    with item(order_id, product_id, quantity) as (
      select
        order_id, product_id, quantity
      from order_items
      union all
      select
        order_id, product_id, quantity - 1
      from item
      where quantity > 1
    )
    select
      order_id, product_id, 1 quantity
    from item
    order by order_id
    ;
    drop table order_items purge
    ;
    
    Table ORDER_ITEMS created.
    
    1 row inserted.
    
    OR PR   QUANTITY
    -- -- ----------
    O1 A1          1
    O1 A1          1
    O1 A1          1
    
    Table ORDER_ITEMS dropped.
    
  • change the color of line based on the value of column 5 Apex in the classic report

    Version of the apex 5.0.0.00.31

    Standard universal theme

    Page theme default template

    Classic report

    Foldable report template

    Hello

    I know this question has been asked several times here, but I'm working on 5 Apex and need to know the correct way to do it in this version.

    I need to change the color of the text of the entire line (no background color) based on the value in one of the columns of the classic report. I have just two conditions, if the value of column = Yes, color should be red, otherwise it must be green.

    I am new to jscript and css, so appreciate if someone can tell me the solution with steps.

    I have already checked this link that changes the value of the column, need to do something similar to the whole line.

    https://tylermuth.WordPress.com/2007/12/01/conditional-column-formatting-in-apex/

    Hi coolmaddy007-Oracle,.

    Here's an example set up on the apex.oracle.com according to the specifications you gave: https://apex.oracle.com/pls/apex/f?p=35467:1

    Version of the apex 5.0.0.00.31

    Standard universal theme

    Page theme default template

    Classic report

    Foldable report template

    Here is how it is done:

    Create a dynamic action with the following specifications:

    Name: Give the appropriate name

    Event: After refresh

    Selection type: region

    Region: select your region classic report

    Condition: No strings attached

    Action: Run the JavaScript Code

    Fire on loading the Page: Yes

    Code:

    $('td[headers="JOB"]').each(function() {
      if ( $(this).text() === 'MANAGER' ) {
        $(this).closest('tr').find('td').css({"color":"red"});
      }
      if ( $(this).text() === 'SALESMAN' ) {
        $(this).closest('tr').find('td').css({"color":"green"});
      }
      if ( $(this).text() === 'CLERK' ) {
        $(this).closest('tr').find('td').css({"color":"blue"});
      }
    });
    

    NOTE: Download the selector appropriate for your knowledge $('td[headers="JOB"]') case using firebug/browser development tools.

    Items concerned: leave blank.

    PS: Changed the example to change the color of text instead of the background color.

    I hope this helps!

    Kind regards

    Kiran

  • Web Forms: Deleting line based on the value of a specific column

    Hello

    I have an online form in which I want to apply delete missing on the ranks, but only on the value of the first column. So, if the first column is #missing I want the deleted row, even if the columns are given in it.

    Is it possible to do this?

    I'm on ver 11.1.2.2 Hyperion Planning

    Shehzad

    Published by: shehzad k on January 24, 2013 11:51

    Unfortunately, no. There is no way to add the delete line based SOLELY on the existence of a value in the first column. It would be nice to see some of the more advanced features "conditional delete", we en flies over to the planning of the entry forms.

    You can do the "clumsy" things with data validations where you gray - out ranks in view of the existence of a value in a particular cell, however while this might SUGGEST that the user should not enter data in a particular line, it would not PREVENT to do so.

    We have seen many improvements in form lately with the introduction of data validations. I hope the momentum continues.

    -Jake

  • Apex 5 schedule: different color based on the value of data field

    Dear Experts,

    I need to have a different color for each record on the calendar based on the value of the data field (eg. category).

    How can I achieve this?

    Thank you!

    See: -.

    You don't have to wait for APEX 5 integration FullCalendar ~ Blog of Doug Gault...

  • Average of the difference in date in minutes

    Hi friends

    I have a table called attendance with 3 columns
    eid  number
    in   date
    out  date 
    two columns (in, out) of date are stored with date and time. The table will have multiple entries
    Is it possible that I can calculate the average of the difference in minutes between in and out of all the records
    using a single query or don't we have the right to use the loop.
    For Example
    
    eid         in                      out             difference in minutes
    1    01-01-2012 09:00:00   01-01-2012 10:00:00              60
    2    01-01-2012 09:05:00   01-01-2012 10:10:00              65  
    3    01-01-2012 09:10:00   01-01-2012 10:20:00              80  
    The result should be the average difference of minutes IE (60 + 65 + 80) / 3 which would be 68.33

    Thanks in advance
    Concerning
    Park

    Hello

    Use

    select avg((out - in) * 24 * 60)
    from 
    

Maybe you are looking for