Get the old value and the new value based on the date

Hello

I have a table called list created below with the rest of the insert statements.

CREATE TABLE ROSTER
(
NUMBER OF ROSTER_EMPLOYEE_DEF_ID
NUMBER OF EMPLOYE_ID
NUMBER OF DEFINITION_REGION_CODE
NUMBER OF DEFINITION_DISTRICT_CODE
NUMBER OF DEFINITION_TERRITORY_CODE
START_DATE DATE,
END_DATE DATE
)



INSERT IN THE LIST
(ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
VALUES
(1,299,222,333,444, 'JUNE 1, 2011', 30 JUNE 2011 "")

INSERT IN THE LIST
(ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
VALUES
(2,299,223,334,445, "1 JULY 2011', JULY 20, 2011" "")

INSERT IN THE LIST
(ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
VALUES
(3,299,224,335,446, 'AUGUST 1, 2011', AUGUST 30, 2011 "")

INSERT IN THE LIST
(ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
VALUES
(4,300,500,400,300, 'JUNE 1, 2011', JUNE 20, 2011 "")

INSERT IN THE LIST
(ROSTER_EMPLOYEE_DEF_ID, EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE)
VALUES
(5,300,501,401,301, "1 JULY 2011', JULY 20, 2011" "")


In the table above we have columns like

EMPLOYE_ID, DEFINITION_REGION_CODE, DEFINITION_DISTRICT_CODE, DEFINITION_TERRITORY_CODE, START_DATE, END_DATE

The result I'm looking for the table above is based on the employe_id OF start_date AND end_date

I need to get the OLD_DEFINITION_REGION_CODE and the NEW_DEFINITION_CODE
Similarly, OLD_DEFINITION_REGION_CODE and the NEW_DEFINITION_REGION_CODE
and OLD_DEFINITION_TERRITORY_CODE and the NEW_DEFINITION_TERRITORY_CODE


I need to get a row of data for each employee saying old value and the new value

for the employee 299 there are 3 records he puts the new record which is the latest date is to say beginning August 1, 2011 and end date of recordings old 30 August 2011
beginning July 1, 2011 and July 20, 2011


For the data in the table above, I need to get the data as below


EMPLOYE_ID OLD_DEFINITION_REGION_CODE NEW_DEFINITION_CODE OLD_DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE START_DATE END_DATE
299 223 224 334 335 20 JULY 11 30 AUG 11
300 500 501 400 401 20 JUNE 11 JULY 20, 11


Please suggest me to get the result above, based on the data. Please let me know if my messages are not clear


Thank you
Sudhir
SELECT  EMPLOYEE_ID,
        OLD_DEFINITION_REGION_CODE,
        NEW_DEFINITION_REGION_CODE,
        OLD_DEFINITION_DISTRICT_CODE,
        NEW_DEFINITION_DISTRICT_CODE,
        OLD_DEFINITION_TERRITORY_CODE,
        NEW_DEFINITION_TERRITORY_CODE,
        START_DATE,
        END_DATE
  FROM  (
         SELECT  EMPLOYEE_ID,
                 ROW_NUMBER() OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE DESC) RN,
                 LAG(DEFINITION_REGION_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_REGION_CODE,
                 DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE,
                 LAG(DEFINITION_DISTRICT_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_DISTRICT_CODE,
                 DEFINITION_DISTRICT_CODE NEW_DEFINITION_DISTRICT_CODE,
                 LAG(DEFINITION_TERRITORY_CODE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) OLD_DEFINITION_TERRITORY_CODE,
                 DEFINITION_TERRITORY_CODE NEW_DEFINITION_TERRITORY_CODE,
                 LAG(END_DATE) OVER(PARTITION BY EMPLOYEE_ID ORDER BY START_DATE) START_DATE,
                 END_DATE
           FROM  ROSTER
        )
  WHERE RN = 1
/

EMPLOYEE_ID OLD_DEFINITION_REGION_CODE NEW_DEFINITION_REGION_CODE OLD_DEFINITION_DISTRICT_CODE NEW_DEFINITION_DISTRICT_CODE OLD_DEFINITION_TERRITORY_CODE NEW_DEFINITION_TERRITORY_CODE START_DAT END_DATE
----------- -------------------------- -------------------------- ---------------------------- ---------------------------- ----------------------------- ----------------------------- --------- ---------
        299                        223                        224                          334                          335                           445                           446 20-JUL-11 30-AUG-11
        300                        500                        501                          400                          401                           300                           301 20-JUN-11 20-JUL-11

SQL>  

SY.

Tags: Database

Similar Questions

  • Compare and get the data in the tables (see post for details)

    I have two tables TableA and TableB. I struggle to write a query to get the dates of TableB (instead of TableA dates) where TableA dates don't coincide with the tableB (beginning and end).

    Example 1: For account A1234,.

    TableA got 2 rows 1/31/2014-3/3/2014 (which corresponds to TableB row), but TableA got another rank 31/01/2014 - 31/01/2014 that corresponds with the date of TableB Begin. In this case, I'm looking for output as below,

    Use TableB start and end date and combine number two rows from TableA for this account

    ACCOUNTTableB_BEGINTableB_ENDAMOUNT
    A123431/01/201403/03/2014100.0000000000

    Example 2: For the B7777 account.

    TableA end date aligns with the end dates of TableB for this account, in this case I want out put as,.

    Use TableB start and end date and get the amount of TableA

    ACCOUNTTableB_BEGINTableB_ENDAMOUNT
    B777705/04/201306/05/2013200.0000000000

    Example 3: On behalf of D5555,.

    Even a TableA line corresponds with TableA, there are two other rows in TableA matching start date with TableA and correspondence with the end date with TableA, in this case, that I put as,.

    Use TableB start and end date and combine number three rows from TableA for this account.

    ACCOUNTTableB_BEGINTableB_ENDAMOUNT
    D555508/08/201410/09/20141100.0000000000

    Example 4: To account E6666.

    Table corresponds to a row with TableB and no additional lines in TableA, just display the data in A table

    Tables and data:

    create table TableA
    (
      Account varchar2(10) not null,
      Begin   date not null,
      End     date not null,
      Amount  number(19,10) not null
    )
    ;
    
    
    create table TableB
    (
      Account varchar2(10) not null,
      Begin   date not null,
      End     date not null,
      Amount  number(19,10) not null
    )
    ;
    
    
    TableA Data:
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('31-01-2014', 'dd-mm-yyyy'), 0.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('03-03-2014', 'dd-mm-yyyy'), 100.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('B7777', to_date('18-04-2013', 'dd-mm-yyyy'), to_date('06-05-2013', 'dd-mm-yyyy'), 120.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('C6666', to_date('25-06-2014', 'dd-mm-yyyy'), to_date('08-07-2014', 'dd-mm-yyyy'), 10.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('16-08-2014', 'dd-mm-yyyy'), 1000.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 0.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('D5555', to_date('16-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 100.0000000000);
    
    
    insert into tablea (ACCOUNT, BEGIN, END, AMOUNT)
    values ('E6666', to_date('01-01-2014', 'dd-mm-yyyy'), to_date('01-02-2014', 'dd-mm-yyyy'), 100.0000000000);
    
    
    TableB Data:
    
    
    insert into tableb (ACCOUNT, BEGIN, END, AMOUNT)
    values ('A1234', to_date('31-01-2014', 'dd-mm-yyyy'), to_date('03-03-2014', 'dd-mm-yyyy'), 100.0000000000);
    
    
    insert into tableb (ACCOUNT, BEGIN, END, AMOUNT)
    values ('B7777', to_date('05-04-2013', 'dd-mm-yyyy'), to_date('06-05-2013', 'dd-mm-yyyy'), 200.0000000000);
    
    
    insert into tableb (ACCOUNT, BEGIN, END, AMOUNT)
    values ('C6666', to_date('06-06-2014', 'dd-mm-yyyy'), to_date('08-07-2014', 'dd-mm-yyyy'), 10.0000000000);
    
    
    insert into tableb (ACCOUNT, BEGIN, END, AMOUNT)
    values ('D5555', to_date('08-08-2014', 'dd-mm-yyyy'), to_date('10-09-2014', 'dd-mm-yyyy'), 1100.0000000000);
    
    
    insert into tableb (ACCOUNT, BEGIN, END, AMOUNT)
    values ('E6666', to_date('01-01-2014', 'dd-mm-yyyy'), to_date('01-02-2014', 'dd-mm-yyyy'), 100.0000000000);
    
    
    
    
    SELECT A.ACCOUNT,
           A.BEGIN,
           A.END,
           A.AMOUNT,
           B.ACCOUNT,
           B.BEGIN,
           B.END,
           B.AMOUNT
      FROM TABLEA A
      LEFT JOIN TABLEB B
        ON A.ACCOUNT = B.ACCOUNT
    

    Hello

    SeshuGiri wrote:

    Hi Frank,.

    Your query/solution works very well, but I forgot to mention something in the first post...

    Please insert these additional lines and try the request again.

    TableA Additional lines:

    1. Insert into TABLEA (ACCOUNT, BEGIN, END, QUANTITY)
    2. values ('F9999', to_date (January 2, 2014 ',' dd-mm-yyyy ""), to_date (3 January 2014 ', 'dd-mm-yyyy'), 999.0000000000);
    3. Insert into TABLEA (ACCOUNT, BEGIN, END, QUANTITY)
    4. values ('A1234', to_date (March 3, 2014 ',' dd-mm-yyyy ""), to_date (4 March 2014 ', 'dd-mm-yyyy'), 999.0000000000);

    TableB Additional lines:

    1. Insert into TABLEb (ACCOUNT, BEGIN, END, QUANTITY)
    2. values ('A1234', to_date (March 3, 2014 ',' dd-mm-yyyy ""), to_date (4 March 2014 ', 'dd-mm-yyyy'), 999.0000000000);

    Question 1:

    The table has a rows for A1234 account (i.e. the time period different than the ranks for the same account)

    one is A1234 31/01/2014-03/03/2014, A1234 03/03/2014-03/04/2014

    Your query that returns two rows for A1234 account (which is what I want), but the amount is messed up.

    ACCOUNT BEGIN END TOTAL_AMOUNT
    1 A1234 31/01/2014 03/03/2014 1100
    2 A1234 03/03/2014 03/04/2014 1100

    Except:

    ACCOUNT BEGIN END TOTAL_AMOUNT
    1 A1234 31/01/2014 03/03/2014 101
    2 A1234 03/03/2014 03/04/2014 999

    Question 2:

    In some cases TableA will have an account (F9999), but the TableB don't. I can just this line by making the Left Join right join?

    I don't get the results with additional data. I get 1099 for two lines where account = 'A1234 '.  I get 1100 as the amount on the line with the account = "D5555.  You did it other changes to data?

    Except:

    ACCOUNT BEGIN END TOTAL_AMOUNT
    1 A1234 31/01/2014 03/03/2014 101
    2 A1234 03/03/2014 03/04/2014 999

    Still, I don't see why you want to 101 for the amount of the first row.  Why not 100?

    How can you know which rows from tablea should get attached to what rows from tableb, when the account is not unique?

    Maybe you want something like this:

    SELECT a.account

    b.begin

    b.end

    SUM (a.amount) AS total_amount

    FROM tablea a

    ON a.account = b.account JOIN tableb B

    AND a.begin BETWEEN b.begin

    AND b.end

    AND a.end BETWEEN b.begin

    AND b.end

    GROUP OF a.account, b.begin, b.end

    ORDER BY a.account

    ;

    but I guess just to your needs, and guessing is not a very good or reliable way to solve problems.

    Question 2:

    In some cases TableA will have an account (F9999), but the TableB don't. I can just this line by making the Left Join right join?

    Yes, it looks that you want an outer join.  What happened when you tried?  As always, post your code, the exact results you want from the given sample data, as well as an explanation of how you get these results from these data.

  • How can I get the date and time function to appear as a tile

    How can I get the date and time function to appear as a tile

    How can I get the date and time function to appear as a tile

    WIN8 are delivered with this tile/app.  The only way to display the time is to launch the charm bar (Win - key + C) or mouse over to the right up/down.  That said go to the Windows store... There are several free applications that display the time / date as a live tile.  Good luck.

  • Cannot get the date system. My input format is %d %m %Y and the output is also a format "YYYYMMDD"?

    Hi all

    I'm using Labview 8.5.

    I'm trying to get the date system.

    I use the Format Date/time string in a "%Y %m %d' format.

    The PROBLEM is the Format Date/time string return "YYYYMMDD" only.

    Please see my attachment to see.

    Please help me with this, whenever I encounter this problem it force to reinstall labview program.

    Best thanks!


  • Code to get the data in the child table in composite SOA using the IOM APIs

    Hi all

    I am a new bie to IOM. I have a query related to obtaining data in the child table using the API of the IOM in the task of embeded java SOA composite.

    I've created a workflow that has a form of child of providing service of slef. I created a composite SOA custom also approval. In the composite approval I have embedded java code and I want to get the values entered in the child form using the API IOM inot the java code embeded in composite SOA.

    I tried gettting the child form data by using getChildAttributes(), but I'm getting the following exception.

    The local Exception stack:
    Exception [EclipseLink-7242] (Eclipse - 2.1.3.v20110304 persistence Services - r9073): org.eclipse.persistence.exceptions.ValidationException
    Description of the exception: an attempt was made to navigate a relationship using indirection that had a null Session. This often happens when an entity has a relationship of LAZY not instantiated is serialized and this lazy relationship is crossed after serialization. To avoid this problem, instantiate the LAZY relationship before serialization.
    at org.eclipse.persistence.exceptions.ValidationException.instantiatingValueholderWithNullSession(ValidationException.java:994)
    at org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:218)
    at org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:83)
    at oracle.iam.request.vo.RequestBeneficiaryEntityAttribute.getChildAttributes(RequestBeneficiaryEntityAttribute.java:100)
    to com. CASApproval.main (CASApproval.java:137)

    Please suggest me if I'm following the correct procedure of the child form data or if we can use another approach.

    Can we get the data using formInstanceOperationsIntf.getProcessFormChildData ().

    Thanks in advance for the help.

    Thank you
    PT

    When you're in approvals, there is no form of process data. Process form data would come only when approvals are completed. If you want to read data from the child form of the DataSet (i.e. the form object as in OIM9.x) you can use the RequestService on the id of the request and read the data. Or another approach would be to the child the dataset data value in the payload of the request and read the XML payload in the composite.
    Let me know if you need more information about the second approach. As for the first approach, search through the forums here and you should find my previous posting on how to reach child dataset values using the ask service API.

    -Marie

    Found these for you:
    OIM11G: Way to get values from dataset of the application for approval
    Re: How to get the value of the AD details of payload of SOA user group

  • Get the date of compilation

    Hello

    Do you know if it is possible to get the date of compilation by programming? What I want to do is to show to the user, via the label, the date that this application has been built.

    Thank you.

    "Erxar" wrote in message
    News:gls2i6$LQS$1@forums. Macromedia.com...
    > I'm sorry but for me, a lemon, this response looks like this:
    >
    > - How to do X?
    > - Just do X and you will have X.
    >
    > Well... Thanks ;)
    >
    > I don't know if you me properly. I don't want this label value
    > the
    > day application starts (I would date to the text of the label
    (> creationComplete or something), but when it is compiled into the swf. Don't you
    > This means that I
    > put this manual before label every relese? Could you please be more
    > accurate?

    I couldn't see the response you are referring, but it seems to me you'll
    To do some kind of technology side server to read the date of the file, then
    Probably spend the value to Flex using flashVars.

    HTH;

    Amy

  • How can I get the data view to display the same amount of time I save?

    I use the Sound and Vibration Measurement Suite.  In the data view, I display a graph of time, the power spectrum, the Color Map and the waterfall.  I am also showing strength in numbers group for several bands and doing cutting-edge research.  I record 100 ms of the transient wave.  In the data view, why the temporal plots show several seconds of data?  What determines how much time will appear in the data view?  More important, the power spectrum reflects the power for the entire of several seconds of data displayed?  Same question for power in the values of band and cutting-edge research.  I want to just this data displayed for 100 ms of the wave that I record.  So, how can I get the data displayed (waveforms) and power numbers come only 100 ms of the recorded wave?

    Finally, what is the best way to make account concisely the recorded data?  By slide numbers on the Documentation tab is not concise, because it comes with graphics, etc..  I tried save as ASCII/LVM, but I get a bunch of stuff intermiated I don't care.  Help?

    Hi TimRsandiego,

    SignalExpress is programmed to display graphs with default scales based on the type of action, it's reading. These scales and settings can be changed by right-clicking on the graph, and then select Properties.

    If you are interested to learn more about how to use SignalExpress, I would recommend checking out some demonstrations/tutorials on NI.com. You can find some of these demos at the following location:

    Let me know if you have any other questions.

    Kind regards

  • How to get the Date, month, year of the DateTimePicker

    Hi, I am using the DateTimePicker.

    There are several question about this command:

    1. how to get the Date, month and year?

    -With the help of myDateTime.value, I get this string ' Wed May 08 14:45 ICT 2013 '-> I have to manually analyze this? Because I need in format yyyy/mm/dd. Or can set the format of dateTimePicker.value?

    2 format on dateTimePicker self (on the user interface) is d/m/YY, I can't change to another format?

    Thank you

    dateTimePicker.value return a QDateTime not a string.

    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__datetimepicker.html#property-value

    See more:

    https://developer.BlackBerry.com/Cascades/reference/QDateTime.html#date

    https://developer.BlackBerry.com/Cascades/reference/QDate.html

    You can get

    day = dateTimePicker.value.date().day()
    month = dateTimePicker.value.date().month()
    year= dateTimePicker.value.date().year()
    dateYYYYMMDD = dateTimePicker.value.date().toString(Qt::ISODate)
    dateYYYYMMDD2 = dateTimePicker.value.date().toString("YYYY/MM/DD")
    dateYYYYMMDD3 = dateTimePicker.value.toString("YYYY/MM/DD")
    
  • < dateformat: create, get the date in en_GB, es_ES instance

    Hello

    I don't know if it's a bug or normal behavior:

    I get the date in en_GB, but I ask the date to es_ES, the snippet of code below:

    < ics:if condition =' < % = ics. GetList ("FechaBlog")! = null & & ics. GetList("FechaBlog").hasData () % > ' >

    < ics:then >

    < ics:listget listname =' < % = "FechaBlog" > "fieldname = 'value' output ="Cash out"/ >"

    < local: create varname = "currLocale" nomlocale = "es_ES" / >

    < dateformat: create name = datestyle 'PostDateFormat' = 'average' timezoneid = "Europe/Madrid" locale = "currLocale" / >

    < name dateformat:getdate = "PostDateFormat" value = "< % = ics." GetVar ("cash") % > ' valuetype = "jdbcdate' varname ="FormattedPostDate"/ >

    < / ics:then >

    < / ics:if >

    22-may-2015

    I expect to get: 22 -mayo- 2015; But if change the 'average' datestyle to "long", I am getting:


    2015 22 Mayo


    as expected, in es_ES.

    This is the normal behavior? WCS 11.1.1.8

    Kind regards

    Hello Jorgitoito,

    This is how Java has shaped the date in Spanish. It is not specific to the WebCenter Sites.

    You can give it a try with this simple Java code:

    java.util.Locale locale = new java.util.Locale("es", "ES");
     java.text.DateFormat mediumFormat   = java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM, locale);
    System.out.println(mediumFormat.format(new java.util.Date()));
    java.text.DateFormat longFormat   = java.text.DateFormat.getDateInstance(java.text.DateFormat.LONG, locale);
    System.out.println(longFormat.format(new java.util.Date()));
    

    The results I got:

    27-May-2015

    2015 27 Mayo

    I suspect that 27-May-2015 here is not in English; It is simply the first three letters of mayo.

    Kind regards

    Stephan.

  • Get the data in table of javafx

    Bat I can get the data in table as:

    [code]

    for (int i = 0; i < dtm.getRowCount (); i ++)

    {

    for (int j = 0; j < dtm.getColumnCount (); j ++)

    dtm.getValueAt (i, j);

    [/ code]

    But how can I do this with javafx table? I google and google and google and no luck.

    In JavaFX make data are stored on a basis per line. Each line contains an element of type T (where you have a TableView), and each column specifies a value using a callback function that determines the value of the column of the value of a particular line.

    You can browse the data simply by practice

    for (T item : table.getItems()) {
      // ...
    }
    

    And then get the value of each column for each element of the given line, since you "know" what each column represents.

    For example, in the example of JavaFX documentation, you could do:

    for (Person person : table.getItems()) {
      String firstName = person.getFirstName(); // value in firstName column
      String lastName = person.getLastName(); // value in lastName column
      String email = person.getEmail(); // value in email column
    }
    

    If you want something really generic, you can try

    for (T item : table.getItems()) {
      for (TableColumn col : table.getColumns()) {
        Callback, ObservableValue> cellValueFactory = col.getCellValueFactory();
        CellDataFeatures cdf = new CellDataFeatures(table, col, item);
        Object cellValue = cellValueFactory.call(cdf).get();
        // do something with cellValue...
      }
    }
    

    If you have little chance to this need, unless you write some kind of framework. (I just typed it here, you may have get dirty you with guys a little to make things).

  • How do I get the data in order by date

    Hello

    I get the data as below, I need the data with null values

    Date col1 col2 col3 col4
    16 November 11 23
    November 17 11 12
    18 November 11 321
    19 November 11 23
    20 November 11 132
    2321 16 November 11
    17 November 11 112
    18 November 11 211
    19 November 11 132
    November 20, 11 12
    16 November 11 45
    17 November 11 465
    2123 18 November 11
    19 November 11 132
    20 November 11 65
    16 November 11 456
    17 November 11 546
    4656 November 18, 11
    19 November 11 566
    20 November 11 564

    need output like below

    Date col1 col2 col3 col4
    16 November 11 23 2321 45 456
    November 17 11 12 112 465 546
    18 November 11 321 211 2123 4656
    19 November 11 23 132 132 566
    20 November 11 132 12 65 564

    Thanks in advance,
    Vincent.

    Delighted ADIK wrote:
    Please post requests INSERT such as requested by another user of the forum. Also mention the version of Oracle.

    Please search for WM_CONCAT.

    http://www.Oracle-base.com/articles/Misc/StringAggregationTechniques.php

    Yes, search for WM_CONCAT, and then COMPLETELY IGNORE IT because it is not the right way to do things. It is undocumented and should not be used similarly recommended.

    Even Tom Kyte says that you should not use it...

    Re: SEPARATE does not not with wmsys.wm_concat

    WM_CONCAT is also an aggregation of chain function, and is not what the OP's request.

    Frank gave the good solution, as evidenced by...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select to_date('16-Nov-11','DD-Mon-RR') as dt, 23 as col1, null as col2, null as col3, null as col4 from dual union
      2             select to_date('17-Nov-11','DD-Mon-RR'), 12, null, null, null from dual union all
      3             select to_date('18-Nov-11','DD-Mon-RR'), 321, null, null, null from dual union all
      4             select to_date('19-Nov-11','DD-Mon-RR'), 23, null, null, null from dual union all
      5             select to_date('20-Nov-11','DD-Mon-RR'), 132, null, null, null from dual union all
      6             select to_date('16-Nov-11','DD-Mon-RR'), null, 2321, null, null from dual union all
      7             select to_date('17-Nov-11','DD-Mon-RR'), null, 112, null, null from dual union all
      8             select to_date('18-Nov-11','DD-Mon-RR'), null, 211, null, null from dual union all
      9             select to_date('19-Nov-11','DD-Mon-RR'), null, 132, null, null from dual union all
     10             select to_date('20-Nov-11','DD-Mon-RR'), null, 12, null, null from dual union all
     11             select to_date('16-Nov-11','DD-Mon-RR'), null, null, 45, null from dual union all
     12             select to_date('17-Nov-11','DD-Mon-RR'), null, null, 465, null from dual union all
     13             select to_date('18-Nov-11','DD-Mon-RR'), null, null, 2123, null from dual union all
     14             select to_date('19-Nov-11','DD-Mon-RR'), null, null, 132, null from dual union all
     15             select to_date('20-Nov-11','DD-Mon-RR'), null, null, 65, null from dual union all
     16             select to_date('16-Nov-11','DD-Mon-RR'), null, null, null, 456 from dual union all
     17             select to_date('17-Nov-11','DD-Mon-RR'), null, null, null, 546 from dual union all
     18             select to_date('18-Nov-11','DD-Mon-RR'), null, null, null, 4656 from dual union all
     19             select to_date('19-Nov-11','DD-Mon-RR'), null, null, null, 566 from dual union all
     20             select to_date('20-Nov-11','DD-Mon-RR'), null, null, null, 564 from dual)
     21  --
     22  -- end of test data
     23  --
     24  select dt
     25        ,max(col1) as col1
     26        ,max(col2) as col2
     27        ,max(col3) as col3
     28        ,max(col4) as col4
     29  from t
     30  group by dt
     31* order by dt
    SQL> /
    
    DT                COL1       COL2       COL3       COL4
    ----------- ---------- ---------- ---------- ----------
    16-Nov-2011         23       2321         45        456
    17-Nov-2011         12        112        465        546
    18-Nov-2011        321        211       2123       4656
    19-Nov-2011         23        132        132        566
    20-Nov-2011        132         12         65        564
    
    SQL>
    
  • Get the date with the millisecond of the table

    I want to get the date with milliseconds in table format in the variable. How to get there?

    SQL > create table test_date (col1 date);

    Table created
    SQL > insert into test_date values (sysdate);

    1 row inserted

    SQL > commit;

    Validation complete

    SQL > select * from test_date;

    COL1
    -----------
    18/12/2009


    Here I have to get datewith "millisecond" format and put it into the variable varchar2 (50) and pass this
    to Java.


    SQL > select to_char (COL1, ' mm/dd/yyyy hh24:mi:ss. FF') of test_date;

    Select to_char (COL1, ' mm/dd/yyyy hh24:mi:ss. FF') of test_date

    ORA-01821: date format not recognized

    SQL >

    Thank you
    Khaldi

    user601042 wrote:
    I want to get the date with milliseconds in table format in the variable. How to get there?

    SQL > create table test_date (col1 date);

    Your data col1 type should be TIMESTAMP.

    See you soon
    Sarma.

  • Try to get the data of

    Help, please:

    I am trying to get the data from the internet in the Simulator. The browser wirks fine and I am able to navigate... but I'm nt get any :-(

    Here is my code:

    String url =

    "http://www * & format = json;

    C = HttpConnection

    null;

    InputStream is =

    null;

    int rc;

    try {

    c = (HttpConnection) Connector.open (url);

    Get the response code is open the connection,

    Send the request and read HTTP response headers.

    The headers are stored until asked.

    RC = c.getResponseCode ();

    if (rc! = HttpConnection.HTTP_OK) {

    throw new IOException ("HTTP response code:" + rc);

    }

    is = c.openInputStream ();

    Get the ContentType

    The string of type = c.getType ();

    The length and process data

    int len = (int) c.getLength ();

    if (len > 0) {

    int actual = 0;

    int BytesRead = 0;

    byte data = newbyte[len];

    while ((bytesread! = len) & (real! = - 1)) {

    real = is.read (data, bytesread, len - bytesread);

    bytesRead += real;

    }

    }

    else {

    int ch;

    while ((ch = is.read (())! = - 1). {

    }

    }

    }

    catch (E ClassCastException) {

    throw new IllegalArgumentException ("not a HTTP URL");

    }

    finally {

    if (is! = null)

    is. Close();

    if (c! = null)

    c.Close ();

    }

    Are you runing the MDS Simulator? It must be upon the connection form the Simulator, unless you specifically request a direct connection by adding «;» deviceside = true' to your URL.

  • I have photoshop on my old computer and my new computer.  How to transfer photo files / scanned so that my links to albums and individuals will be kept?

    I have photoshop on my old computer and my new computer.  How to transfer photo files / scanned so that my links to albums and individuals will be kept?

    Duplicate the file system tree that you have on your old computer to your new computer. Use your home network to access your old computer to your new computer drive and just copy the files required for your new computer and disks that are the same driver on the new machine you letter.

  • Get the Date format that the user sets in "Preferences".

    Hello
    Is it possible that I can get the date format (for example: "DD-MMM-YYYY', 'DD-MM-YYYY' etc.) where the user desires under 'Préférences' in a page of the OPS?

    Concerning
    Hawker

    Published by: HawkerHunter on Aug 6, 2011 11:02

    ICX_DATE_FORMAT_MASK - is the value of profile that contains the value that is selected in the preferences page.
    You can try pageContext.getProfile ("ICX_DATE_FORMAT_MASK");
    in your code.

    Kind regards
    Krishnan guru.

  • Try to get the data in a field of classical entry in a clip

    I'm working on a project basis CMS (for self learning purposes) and I'm stuck on something trying to get data from a text inside a frame of the movie entry.  The code works with the homeUpdate_btn on the same level as the home_input_txt.

    When I run the file (swf), the homeUpdate_btn does not show because it isn't at the level of the root parent level. (it's inside the clip with the home_input_txt).

    So, if I put the homeUpdate_btn in the parent level (I hope I rethink my levels).  The button is not able to get the data in the home_input_txt field which is at the root.

    I would like to try this again... you can see the classic home_input_txt of parent level (outside the movie clip and make changes), but you can see the homeUpdate_btn of this level.  So to see the homeUpdate_btn I set at the parent level.  Now how I update and obtain data on the level of the root of the home_input_txt... .inside the clip?

    __________________________________________________________________________________________ _____________________________

    I think it's the line that update data comes... that is text entry: homeEdit_variables.home_body = home_input_txt.htmlText;

    ________________________________________________________________________

    Issue: homeUpdate_btn does not show inside the clip when I run.

    ______________________________________________________________________

    Any Action Script for "Udate Home Page.  (again within a clip)

    Stop();

    restrict the characters that the user can type into the text entry field

    home_input_txt. Restrict = "A-Za-z 0-9,.? $& = @_ « ;

    put current home page data in the field of text for editing

    home_input_txt.htmlText = homePageText;

    Assign a variable name for our URLVariables object

    var homeEdit_variables:URLVariables = new URLVariables();

    Build the varSend variable

    var homeEdit_varSend:URLRequest = new URLRequest ("cms_control_file.php");

    homeEdit_varSend.method = URLRequestMethod.POST;

    homeEdit_varSend.data = homeEdit_variables;

    Build the varLoader variable

    var homeEdit_varLoader:URLLoader = new URLLoader;

    homeEdit_varLoader.dataFormat = pouvez;

    homeEdit_varLoader.addEventListener (Event.COMPLETE, completeHandler_home_edit);

    Completion of script handler PHP and return

    function completeHandler_home_edit(event:Event):void {}

    gotoAndStop ("home");

    }

    Add an event listener for the button send and what function to perform

    homeUpdate_btn.addEventListener (MouseEvent.CLICK, updateHomePage);

    Validation of form fields and send the variables when you click on the button

    function updateHomePage(event:MouseEvent):void {}

    Loan variables for sending

    homeEdit_variables.sendRequest = "update_home_page";

    homeEdit_variables.home_body = home_input_txt.htmlText;

    Send the data to the php file

    homeEdit_varLoader.load (homeEdit_varSend);

    }

    I get this error message:

    Symbol "page content", layer 'actions', frame 25, line 44 1119: access to property may be undefined home_input_txt through a reference with static type flash.display:DisplayObjectContainer.

    _______________________________________________________________

    mc_edit is the name for the clip

    So I thought I would say that there... the... in home_input_txt.htmlText the container movie clip.

    I changed the line below in the action script where is the button.

    ______________________________________________________________________________

    homeEdit_variables.home_body = mc_edit.home_input_txt.htmlText

    __________________________________________________________________________

    It worked :-)

    Maybe it's not the right way, but it will solve the problem send me severe headaches... Laughing out loud

    Thank you for all your quick responses.  You kept me motivated

Maybe you are looking for