How to transpose a line date wise?

Dear Experts,

How to transpose a line date wise?

date            value
11-jan-2016 101
11-jan-2016 102
11-jan-2016 103
12-jan-2016 104
12-jan-2016 105
12-jan-2016 106
13-jan-2016 107
13-jan-2016 108
13-jan-2016 109

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

Expected results

date            value     value_2 value_3
11-jan-2016 101 104 107
11-jan-2016 102 105 108
11-jan-2016 103 106 109

Thank you for your help in advance.

Kind regards

IVW

Hello

Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.

Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.

Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: Re: 2. How can I ask a question on the forums?

and: Re: 4. How can I convert rows to columns?

Swivel (which is the generic name for what you want to do) assume that you can tell, by looking at each input line, you can specify what columns of output that the row will affect.  In this case, it seems that you need to derive a column like this, perhaps using the ROW_NUMBER analytic function.

Tags: Database

Similar Questions

  • 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 can I insert a date on the signature line?

    How can I insert a date automatically on the signature line?

    Digital signature fields display the date and time when they were signed by default.

  • How to view NTUSER. DAT file as to the registry without using it?

    How to view NTUSER. DAT file as to the registry without using it?

    The file is from a different Windows instalation!
    I have Win 7 but it comes from my old Windows xp.

    Hi Leonnis,

    There are many ways to read the registry file without using regedit.
    Some ways:
    RegLookup: RegLookup project is dedicated to the direct analysis of Windows NT registry files. RegLookup is distributed under the GNU GPL license and is implemented in ANSI C. RegLookup provides a C API, a Python module and command line tools to access registry data structures.
    Download here: http://projects.sentinelchicken.org/reglookup/
    RegViewer: Is GTK 2.2 based registry Windows GUI file browser. It is platform-independent for the review of the files of Windows registry from any platform. Particularly useful in forensics files Windows of * nix systems.
    Download here: http://regviewer.sourceforge.net

    RegRipper:

    RegRipper is an application of forensics software open source developed by Harlan Carvey. RegRipper, written in Perl, is a tool for extracting data from Windows registry.
    Download here: http://regviewer.sourceforge.net
    KRegedit:
    kregedit is a KDE utility for the visualization of the native Windows registry files. It is similar to the regedt32 utility that is found on most Windows platforms. Only the format of the NT (NT4/2000/XP) registry is supported.
    Paulo Breim
    Centro Brasileiro Pericia

    Help, please!

  • How to convert a xs: date for XS: DateTime

    In my application, there are the following 2 cases, I need to manage:

    1. I have a "XS: date" and I need to convert it in "XS: DateTime".
    2. I have a "XS: date" and a "XS: Time" and I need to combine in ' XS: DateTime.

    Following the answer to this question on Stackoverflow, I tried both " xs:dateTime($date) "and" fn:dateTime($date, $time) " but none of them worked.

    When I used " xs:dateTime($date) " to manage the 1st case, I got the following exception during the OSB has reached the stage of conversion for the date:

    OSB Replace action failed updating variable "body": Error parsing XML: {err}XP0021: "2014-12-09": can not cast to {http://www.w3.org/2001/XMLSchema}dateTime: error: date: Invalid date value: wrong type: 2014-12-09

    When I used " fn:dateTime($date, $time) ", the transformation is not yet accepted by the IDE. " It displays the following error:

    line 113, column 42: "{http://www.w3.org/2004/07/xpath-functions}dateTime" unknown function (or number of arguments (2) is wrong

    For now, as a solution, I use 'concat' to combine the date and time fields in the 2nd case and add 'T00:00:00' to handle case 1, but I think that this is not a good approach.

    I would be very grateful if you could show me how I can correctly convert date in dateTime format fields.

    For the moment, I use OSB 11 g with the last v11.1.1.7.4 grouped patch applied.

    Found in the documentation that, in fact, only the working paper 2004-07 is implemented in this version:

    https://docs.Oracle.com/CD/E28280_01/admin.1111/e15867/XQuery.htm#OSBAG444

    According to the specifications, the casting of XS: date for XS: DateTime should work:

    XQuery 1.0 and XPath 2.0 functions and operators

    But as I mentioned previously, it is perhaps that you do not pass the correct data type.

    If the data are not based on a schema, then sch:jdOriginalPromisedDeliveryDate will be considered from type xdt: untypedAtomic and cannot be cast in all except XS: String.

    Is - it works better:

    {xs: date ($jdOriginalPromisedDeliveryDate) cast as xs: DateTime}

    ?

  • How to manage the lines multiple region table OFA

    Hi gurus,

    I'm new to the development of new Pages of the OFA. Please help me how to manage multiple lines in the table region OAF.

    My requirement I'm not able to manage multiple lines in my area of Table.

    First row in my table area I am selected date_start and date_end when I select the end_date I need I need difference bet ween dates.

    My problem is I am able to manage the first Table line but I am not able to manage the table still ranks when I fire that time I first get the rank only.

    POS:

    14/08/12 07:59:40 1

    14/08/12 07:59:40 inside

    14/08/12 07:59:40 date difference is 86400000

    14/08/12 07:59:40 date difference is 1

    14/08/12 07:59:40 date is less than 365

    14/08/12 07:59:57 1

    14/08/12 07:59:57 inside

    14/08/12 07:59:57 date difference is 86400000

    14/08/12 07:59:57 date difference is 1

    14/08/12 07:59:57 date is less than 365

    14/08/12 08:00:13 1

    14/08/12-08:00:13 inside

    14/08/12 08:00:13 date difference is 86400000

    14/08/12 08:00:13 date difference is 1

    14/08/12 08:00:13 date is less than 365

    My custom logic:

    If (DutDetSEndDat".equals (pageContext.getParameter (EVENT_PARAM))) {" "}
    DateDiff (pageContext, webBean);
    //Am = XxDutyTravelAMImpl
    //(XxDutyTravelAMImpl) pageContext.getApplicationModule (webBean);
    OAViewObject = oaviewobject1
    (OAViewObject) am.findViewObject ("XxDutyTravelDuDetEOVO1");

    System.out.println("1");
    If (oaviewobject1! = null) {}
    System.out.println ("Inside");
    oaviewobject1. Reset(); New line added
    oaviewobject1. Next(); new line added
    Line OARow = (OARow) oaviewobject1.getCurrentRow ();

    Date sDate = (Date) row.getAttribute ("DutdetStartDate");

    Date = eDate (Date) row.getAttribute ("DutdetEndDate");
    java.util.Date VChangeDateTime =
    new java.util.Date (sDate.timestampValue () .getTime ());

    If (sDate! = null & & eDate! = null) {}
    long m1 = sDate.timestampValue () .getTime ();
    long m2 = eDate.timestampValue () .getTime ();

    long diff = m2 - m1;
    System.out.println ("difference in date is" + diff);
    int diffDays = Math.round (diff / (24 * 60 * 60 * 1000));
    System.out.println ("difference in date is" + diffDays);
    If {(diffDays > 365)
    System.out.println ("Date is greater than 365");
    } else {}
    System.out.println ("Date is less than 365");
    }
    }
    }
    }

    Kind regards

    Srinivas

    Hi Srini,

    To get the event line descriptor that shot please use code below.

    If (DutDetSEndDat".equals (pageContext.getParameter (EVENT_PARAM))) {" "}
    DateDiff (pageContext, webBean);
    Am = XxDutyTravelAMImpl
    (XxDutyTravelAMImpl) pageContext.getApplicationModule (webBean);

    String rowRef = pageContext.getParameter (OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    OARow line = (OARow) am.findRowByRef (rowRef);

    Date sDate = (Date) row.getAttribute ("DutdetStartDate");

    Date = eDate (Date) row.getAttribute ("DutdetEndDate");
    java.util.Date VChangeDateTime =
    new java.util.Date (sDate.timestampValue () .getTime ());

    If (sDate! = null & eDate! = null) {}
    long m1 = sDate.timestampValue () .getTime ();
    long m2 = eDate.timestampValue () .getTime ();

    long diff = m2 - m1;
    System.out.println ("difference in date is" + diff);
    int diffDays = Math.round (diff / (24 * 60 * 60 * 1000));
    System.out.println ("difference in date is" + diffDays);
    If {(diffDays > 365)
    System.out.println ("Date is greater than 365");
    } else {}
    System.out.println ("Date is less than 365");
    }
    }
           
    }

    Thank you

    Vlaminck

  • How to avoid default line on a table

    Dear members,

    I created a simple JSF page using ADF.

    On the page, I display departments and employee data.

    Data display of the departments using the ADF form and data from employees are displayed using the Table of the ADF.

    When I run the page a default line will appear above the Table of the ADF.

    I ask you to please let me know, how to avoid this line by default displayed on the top of the table.

    Thanks in advance.

    Kind regards.

    DOH - I just realized. This is for filtering :)

    Set the property 'filterVisible' to your table to "false".

  • How do I get the date of last Saturday

    Hello

    How can I calculate the date of last Saturday

    IND > select sysdate double;

    SYSDATE
    ---------------------
    08 - jun - 11:04:43:36:pm

    1 selected line.

    IND > NEXT_DAY(sysdate,'SAT') SELECT-double 7;

    NEXT_DAY (SYSDATE,'SAT)
    ---------------------
    04 - jun - 11:04:43:44:pm

    1 selected line.

  • How to insert multiple lines using a single query

    Hi all

    How to insert multiple lines using a single query to the emp table?
    I have the number of rows to insert into table x. consumes a lot of time. I tried to insert several lines using a single query, but get errors. I know exactly the query to do this.


    Thank you
    Sunil

    Like this?

    SQL> create table test(id number , dt date);
    
    Table created.
    
    SQL> insert into test values(&a,&b);
    Enter value for a: 1   --- It asked me and I entered 1
    Enter value for b: sysdate  --- It asked me and I entered sysdate
    old   1: insert into test values(&a,&b)
    new   1: insert into test values(1,sysdate)
    
    1 row created.
    
    SQL> 
    

    g.

  • How to transfer a line of table (instance) from table1 to table2?

    Hello - I am an active user of the following Adobe LC designer but I'm getting into difficult (for me) territory regarding the javascript coding!

    My problem is the following: how to transfer an instance of array (lines) of the object table 1 to table 2?

    that is, there are 2 tables on a form and I want to click a button that removes the first line from Table1 and insert this same line (data intact) at the bottom of table 2

    the code I used below does not work! (it could be complete rubbish but, like miles off the mark)


    var oTransferInstance = form1.pg1.subformRow [0];
    var nIndexFrom = oTransferInstance.index;
    var nIndexTo = form1.pg2.subformRow.index + 1;

    Form1.PG1.subformRow.instanceManager.moveInstance (nIndexFrom, nIndexTo);

    Help, please! I'll be very grateful

    concerning

    David

    Sure, send it to [email protected] and include a descriptionof the question.

    Paul

  • How can I create a data file?

    I am back. I found the CFA & PEF files and I'm about to go to work and remove all these on all my drives.

    What I need to know now is how to create a single data file on a DVD for the back upward.  I have burned successfully a DVD in Encore, but I don't want to use it as a return to the top

    I think it would be deteriorating a bit. In addition, it's a file again.

    What I want is a Premiere CS4 file. This way I can always go back and make any changes or modifications in the original time line.

    If I can do this, I was planning on using a DVD - RW so I could make changes later.

    I also want to do a transfer DVD to install my project on another computer. It is a single computer video without an internet connection to mess with my OS and slow things down.

    Thanks again

    For projects, the trick will be the files of components. If they will be fit on DVD DL discs, you're OK. If they are too big (DV - AVI is ~ 13 GB per hour), then you will need a type of backup or covering the software, who will write the files on multiple disks. A better choice, IMO, would be an external to 1 to 2 to, where you can use the project manager, or just Windows Explorer and copy, to see the entire project with assets folder. I do not recommend a USB key and go at least for FW - 400. FW - 800 would be better, but you will need FW 800 connections on your computer. eSATA would be the best, but then you will need eSATA connectors.

    Good luck

    Hunt

  • GL book with dates wise (wise not period)

    Hello


    I have a question who belong to the GL report

    I need a report GL that show only one account including as fresh, rent expenses electricity whose specific setting date wise (for example 1st January 2010 to January 17, 2010)... bt I have not found this report... How can I get this module GL report where I can find with the accounting date wise?

    Double post.

    GL book with dates wise (wise not period)
    GL book with dates wise (wise not period)

  • How to compare two lines in PL/SQL?

    Hi all

    How to compare two lines in PL/SQL? Is there a method I can use to compare their column by column instead?

    Any comments would be much appreciated.

    PhoenixBai wrote:
    By lines I mean, two rows of the same table!

    Ah, finally, we get a bit more useful information

    and I need to compare the column by column to see if there is a difference between these two rows.

    Like this, you mean?

    SQL> ed
    Wrote file afiedt.buf
    
      1  with data as (select 1 as id, 'A' as dta, 'B' as dta2 from dual union all
      2                select 2, 'A', 'B' from dual union all
      3                select 3, 'B', 'C' from dual)
      4  --
      5      ,chk as (select &id1 as id1, &id2 as id2 from dual)
      6  --
      7  select case when (
      8    select count(*)
      9    from (
     10      select dta, dta2
     11      from data, chk
     12      where id = id1
     13      minus
     14      select dta, dta2
     15      from data, chk
     16      where id = id2
     17      )
     18    ) = 0 then 'No Difference'
     19          else 'Difference'
     20          end as check_result
     21* from dual
    SQL> /
    Enter value for id1: 1
    Enter value for id2: 2
    old   5:     ,chk as (select &id1 as id1, &id2 as id2 from dual)
    new   5:     ,chk as (select 1 as id1, 2 as id2 from dual)
    
    CHECK_RESULT
    -------------
    No Difference
    
    SQL> /
    Enter value for id1: 1
    Enter value for id2: 3
    old   5:     ,chk as (select &id1 as id1, &id2 as id2 from dual)
    new   5:     ,chk as (select 1 as id1, 3 as id2 from dual)
    
    CHECK_RESULT
    -------------
    Difference
    
    SQL>
    

    My only concern is the result of this sql. East - reliable? It can really be used to differentiate the two lines? I mean, the result would be the same, as I do with Java?

    Not sure what you mean by "reliable"? SQL is not some kind of generator of random result (by derogation from the use of the DBMS_RANDOM package). If you ask him if 1 + 1 = 2, then it will always give you the right answer.

  • How to load the clob data in a table.

    Hello

    I loaded a column clob with a text file which has about more than 1000 lines, now the clob column has all the records as if it were a line... at the end of each record in the clob column, I think the value of this function: Chr (13)... I think it means end of line or new line something like that.. .my question is how can I move these data in a normal table... .i need a code which share this intro to data rows so I can insert them into a table...

    Thanks in advance...

    OAIS

    Sorry, but my code is designed to give you a starting point for how to address your problem, not a complete solution.

  • How can I erase the data on my laptop before I give it away?

    How can I erase the data on my laptop before I give it away?

    See this document.

    https://support.Apple.com/en-us/HT201065

Maybe you are looking for