Add up the values from two numeric columns on RTF model

Hello

I'm trying to add up the values of the numeric column 2.

I tried..? column_1 and column_2? > but it's not as simple as that obviously I get an error when you try to do

I tried..? sum (current - group () / column_1) + sum (current - group () / column_2)? >, but who does no more work that it also returns an error


Any ideas how to add two numeric columns in RTF model?

for 2 + 3

 

Tags: Oracle Development

Similar Questions

  • Starting from two data tables, how do you get the values in two columns using values in a column (values get col. If col. A is not null values and get the pass. B if col. A is null)?

    Two tables provided, how you retrieve the values in two columns using values in a column (the pass get values. If col. A is not null values and get the pass. B if col. A is null)?

    Guessing

    Select nvl (x.col_a, y.col_b) the_column

    from table_1 x,.

    table_2 y

    where x.pk = y.pk

    Concerning

    Etbin

  • Passing the value from one page to the other page

    Hi gurus,

    I need to pass the value from one page to the other page and two pages use different AMs.
    In the first page I have sellers results region table where the $vendor_name column is a hyperlink that navigates to the page Vendor_Sites. Now after accessing the second page, I want to excute the VendorSitesVO in PR of CO based on the value passed to VendorsVO (vendor_id) of first page.

    can someone help me on this?

    Thank you
    Vincent.

    Published by: user4933347 on December 4, 2009 12:19 AM

    You can set parameters of Pagecontext and transmit values through them. These values can be passed between pages, even if the AMs are different.

    Try:
    pageContext.putParameter ("Parameter1", value1);
    pagecontext.setForwardURL (second page)

    Concerning
    Sumit

  • Impossible to select the value from the search screen (quick select, then) on OFA

    Hello

    We have a problem with a user who are not able to select any value from the LOV on any page of the Oracle.

    1. click the button of LOV

    2. search + go

    3. Select or quick selection nothing happens (error on the Page appears in the left corner of the homepage)

    4. only cancel works.

    Any suggestion would be appreciated.

    I saw a similar question posted Impossible to select the value from the search screen (quick select, then) on OFA

    But unfortunately this is not the answer.

    Thank you

    Sam

    Display of the solution to help others. I tried to connect a SR and suddenly a pop Note ups that helped.

    The problem is related to the profile "Self Service Accessibility Features" customer has defined for the user concerned.

    Follow these steps:

    1 change the value of 'None' profile at the user level.

    2 disconnect / connect to the application and testing.

    See you soon.

  • get the value of two fields in a field

    Hellou,

    I need some new help with javascript

    Currently I use the below code to get the value of one field to another:

    getField("Text35").value = getField("Text1").valueAsString;

    Now, I wonder how to change this code, so I could get the values of two fields in one. I for example field 'Name' and 'name' field, now I want to show in the field 'name '.

    Example, if the firstname field have John value and the value of the lastname field is Doe, I want to show in the field name as "John Doe".

    I hope that u understand what I want

    Thank you for helping me!

    getField("Text35").value = getField("Text1").valueAsString + "" +.

    getField("Text2").valueAsString;

  • the minimum value of two calculated columns column

    Hi all

    Please, help me in the following scenario.

    I have to get the data in two tables, so whatever the columns I need to put it in the select statement, but I have to do the calculations for two columns, and assigned an alias to these two calculated columns name, lets say X & Y.

    I need to show the data in column Z, the rule for this column must have a minimum value of columns X and Y.

    I have to use only a select statement and retrieve the data. Camnt make changes or creating features on the database.

    Thnaks in advance.

    Use a view inline and function LESS.

    http://download.Oracle.com/docs/CD/E11882_01/server.112/e17118/queries007.htm#SQLRF52357

    http://download.Oracle.com/docs/CD/E11882_01/server.112/e17118/functions087.htm#SQLRF00657

  • How to get the value of EV - the diiference between two different columns

    Hello
    I get the difference between the two different columns of two different... as tables (emp.sal - dept.comm)... all I want is I need only the records that a negative gap how get this? Please help me
    Thanks in advance

    If I understand your question right:

    select
      case when emp.sal-dept.comm>=0 then YOUR_VALUE
             else emp.sal-dept.comm
      end difference_value
    from emp,dept...
    

    or do you want to:

    select
      ...
    from emp,dept...
    where emp.sal-dept.comm<0
    

    ?

    Kind regards
    Sayan M.

    Published by: xtender on 19.11.2010 22:29

  • What SYS tables (not seen) contains the value NULL spec /not/ column definition?

    What SYS (or tables) store the value of a spec /not/ NULL columns? (It doesn't seem to be COL$)

    NOTE: This is NOT a trick question - although it seems to be.

    Test configuration:
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    Test configuration:
    1. a table is created by SCOTT in the SCOTT schema with a NULLABLE column.

    2. a primary key constraint is added using only the NULLABLE column

    3. Requests for information on USER_TAB_COLS, ALL_TAB_COLS, DBA_TAB_COLS and SYS. COL$ see NOT NULL for the column NULLABLE
    as necessary for a primary key constraint. Views derive their data from the column of $ NULL the sys. Table of $ COL
    using
    'DECODE (SIGN (c.null$), -1, 'D', 0, 'Y', 'N'),
    and the table of $ COL shows a numerical value of '0' before you add the primary key and a value of "1" later.

    4. a query on the DDL metadata table shows the specification for column NULLABLE of origin involved.

    Question - where this original specification NULLABLE is stored?

    This question is based on a question asked by another user in this thread
    Columns becoming nullable after a fall of primary key?

    I created the following specially for that matter test case
    -- scott ensures table does not exist
    DROP TABLE tbl_test CASCADE CONSTRAINTS;
    
    -- scott creates a table
    CREATE TABLE tbl_test ( col_1 NUMBER,
    col_2 NUMBER NOT NULL);
    
    -- scott queries to check the the column nullable status
    SELECT table_name, column_name, nullable 
    FROM user_tab_cols
    WHERE table_name = 'TBL_TEST';
    
    -- TABLE_NAME | COLUMN_NAME | NULLABLE
    -- TBL_TEST   | COL_1       | Y 
    -- TBL_TEST   | COL_2       | N 
    
    -- Scott addes a primary key constraint using only the nullable column
    ALTER TABLE tbl_test ADD CONSTRAINT tbl_test_pk PRIMARY KEY(col_1);
    
    -- scott queries to check the the column nullable status
    SELECT table_name, column_name, nullable 
    FROM user_tab_cols
    WHERE table_name = 'TBL_TEST';
    
    TABLE_NAME,COLUMN_NAME,NULLABLE
    TBL_TEST,COL_1,N
    TBL_TEST,COL_2,N
    
    -- scott queries to get the table DDL
    select dbms_metadata.get_ddl('TABLE', 'TBL_TEST', 'SCOTT') FROM DUAL;
    
    DBMS_METADATA.GET_DDL('TABLE','TBL_TEST','SCOTT')
    
      CREATE TABLE "SCOTT"."TBL_TEST" 
       (     "COL_1" NUMBER,                   <------ where is this NULLABLE spec stored? 
         "COL_2" NUMBER NOT NULL ENABLE, 
          CONSTRAINT "TBL_TEST_PK" PRIMARY KEY ("COL_1")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING
      TABLESPACE "USERS"  ENABLE
       ) SEGMENT CREATION DEFERRED 
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      TABLESPACE "USERS" 
    The DOF shows that Oracle keeps the original spec NULLABLE for the column and uses it to generate the DDL orginal, even if there is a primary key on the table and the system views (and COL$) show the column non NULLABLE.

    So where is the original information NULLABLE actually stored?

    rp0428 wrote:
    What SYS (or tables) store the value of a spec /not/ NULL columns? (It doesn't seem to be COL$)

    I think that it becomes a bit messy depending on order of activity:

    You can see Col. .null$ is set to a non-zero when the desrcibe command displays the column as not null, but it can happen for two reasons:
    (a) user sets the column as not null - in which case you get a line in cdef$ with type # = 7
    (b) the user adds a primary key to table - in which case you get a line in cdef$ with type # = 2

    If you declare null AND add a primary key, you get two lines - that's why it is possible for Oracle to determine if he should remove the flag not null when you remove the primary key and also allows dbms_metadata show the create statement of table without a NOT NULL even when describe it the watch with a NOT NULL - dbms_metadata can respond to the presence of the type # = 2 and absence of the type # = 7.

    Concerning
    Jonathan Lewis

    By the way: by a strange coincidence, it seems to me answering the previous post, three days before it was asked: http://jonathanlewis.wordpress.com/2012/04/19/drop-constraint/#comment-46140 (on the doubts, this isn't - it answers a different question on the removal of constraints).

    Published by: Jonathan Lewis April 23, 2012 11:07

  • To access the values from the row outside the ListView ListItem

    Hello

    I spent two hours browsing the forums and documentation with no chance of finding a solution on how to access the list item data from outside the listview.

    Let explain me my code. It is marked with I work and what does not work and its expected behavior.

    Should work behavior


    Tapping & getting data

    The arrayDataModel is filled with 4 rows. Firstly the list item, second item in the list... etc.

    • Tapping on the order of the day, label with the id of triggeredText displays the value of a threaded list item.
    • The index of the tapped icon appears in the label with the id of triggerredIndex.

    Incrementing Index using ActionItems onBar

    By pressing action items 'previous' and 'next', you can increment the index value to the label with the id of triggeredIndex. The order of the index is 0-4, even as total of the items in the list.

    How to extract data from the index when the value of triggeredIndex?

    Buttons

    The buttons at the bottom of the screen... Select 1, select the 2nd, 3rd Select should select indexes 0,1,2 of the list and display the value in triggeredText and triggeredIndex. They do not work.

    How did I pull the values when you click the buttons?

    import bb.cascades 1.3
    
    TabbedPane {
        id: root
        showTabsOnActionBar: false
    
        Tab {
            id: mainTab
            title: "Test List"
                Page {
                    id: mainPage
                    titleBar: TitleBar {
                        title: "List Traversal Test"
                    }
                    actions: [
                        ActionItem {
                            title: "Previous"
                            ActionBar.placement: ActionBarPlacement.OnBar
                            onTriggered: {
                                // get current selected index from list=
                                var currentIndex = parseInt(triggeredIndex.text);
    
                                if(currentIndex <= 0){
                                    //do nothing already at first item
                                }else{
                                    // subtract 1 from index ( ci - 1) ?
                                    var newIndex = parseInt(triggeredIndex.text) - 1;
    
                                    // show data from new selected index
                                    // ???
    
                                    // triggeredItem.text = XXX // the data
                                    // ???
    
                                    // triggeredIndex.text = X // the current index
                                    triggeredIndex.text = newIndex;
                                }
                            }
                        },
                        ActionItem {
                            title: "Next"
                            ActionBar.placement: ActionBarPlacement.OnBar
                            onTriggered: {
                                // get current selected index from list=
                                var currentIndex = parseInt(triggeredIndex.text);
    
                                if(currentIndex == 4){
                                    //do nothing already at lastitem
                                }else{
                                // add 1 to index ( ci + 1) ?
                                var newIndex = parseInt(triggeredIndex.text) + 1
    
                                // show data from new selected index
                                // ???
    
                                // triggeredItem.text = XXX // the data
                                // ???
    
                                // triggeredIndex.text = X // the current index
                                triggeredIndex.text = newIndex;
                            }
                            }
                        },
                        ActionItem {
                            title: "Clear"
                            ActionBar.placement: ActionBarPlacement.OnBar
                            onTriggered: {
                                // set current index to 0 (top item in list)
                            }
                        }
    
                    ]
                    Container {
                        preferredHeight: maxHeight
                        layout: StackLayout {
                            orientation: LayoutOrientation.TopToBottom
                        }
    
                        Label{
                            id: triggeredItem      // value of listitem from current index
                            text: "0"
                        }
                        Label{
                            id: triggeredIndex    // current index
                            text: "0"
                            onTextChanged: {
                                // set triggeredItem.text to contents of selected ListItem with same index
                                // STUCK HERE cannot access ListItem.dataModel(indexPath) from here....
                            }
    
                        }
                        Container{
                            ListView {
    
                                id: theList
                                objectName: "dalist"
                                dataModel: ArrayDataModel {
                                    id: theListModel
                                }
                                listItemComponents: ListItemComponent {
                                    StandardListItem {
                                        id: itemRoot
                                        title: ListItemData
                                    }
    
                                }
                                onTriggered: {
                                    var si = dataModel.data(indexPath);
                                    triggeredItem.text = "LIST ITEM CONTENT: " + si;  //set content when user taps on item
                                    triggeredIndex.text = "LIST ITEM INDEX INDEX: " + indexPath;  // set index when user taps
                                }
    
                                onSelectionChanged: {
                                    //console.log(selected);
                                }
    
                                onCreationCompleted: {
    
                                    //add some data to the listview
                                    theListModel.append("First List Item");
                                    theListModel.append("Second List Item");
                                    theListModel.append("Third List Item");
                                    theListModel.append("Fourth List Item");
                                }
                            }
    
                        }
                        Container{
                            layout: StackLayout {
                                orientation: LayoutOrientation.LeftToRight
                            }
                        Button{
                            text: "Select 1st"
                            onClicked: {
                                theList.clearSelection();
                                theList.select(0);
    
                            }
                        }
                        Button{
                            text: "Select 2nd"
                            onClicked: {
                                theList.clearSelection();
                                theList.select(1);
    
                            }
                        }
    
                        Button{
                            text: "Select 3rd item"
                            onClicked: {
    
                                //expected behaviour is to show data from Third List Item
    
                                // triggeredIndex.text = INDEX 3
                                // triggeredText.text = (DATA FROM THIRD LIST ITEM)
    
                                // THIS IS NOT WORKING ....
                                theList.clearSelection();
                                theList.select(2);
                                console.log(theList.dataModel(3));
                                triggeredItem.text = theListModel.dataModel(3);
    
                            }
                        }
                    }
                   }
                }
            }//tab
    }
    

    Thank you and have a happy and healthy 2015!

    Your help will be greatly appreciated.

    I ran and got this:

    asset:///main.qml:161: TypeError: Result of expression 'theList.dataModel' [bb::cascades::ArrayDataModel(0x1091a838)] is not a function.
    

    But it works

    theListModel.data([3])
    

    But this isn't the solution, you have a more serious problem. You select a value, you trigger. If you add this in onTriggered you select it (and you can see that it changes color when it is selected).

    theList.select(indexPath);
    

    If you want to use option to deselect

    theList.select(indexPath, !theList.isSelected(indexPath));
    

    And if you want to have that one chose this

    theList.clearSelection();
    theList.select(indexPath);
    

    Inside the button 'Select the 3rd point' allows to select programmatically

    theList.select([2]);
    

    It works but I'm not sure what you're trying to do

  • The value of name of column

    Hi gurus

    I'm stuck on 1 Scenario and need your help. I have the following table:

    Create table

    drop table age_rate;

    CREATE TABLE age_rate
    (
    age_0_4 number 4,
    age_5_20 number 4,
    age_21_34 number 4,
    age_35_44 number 4
    );

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

    Insertion

    INSERT INTO age_rate

    SELECT 45, 50, 60, 90 double UNION ALL

    SELECT 45, 50, 60, 88 OF double UNION ALL

    SELECT the 40, 50, 60, 90 double UNION ALL

    SELECT 5, 50, 60 and 88 DOUBLE;

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

    Query on table

    SELECT * from age_rate;

    The query result

    age_0_4 age_5_20 age_21_34 age_35_44

    45                          50                     60                     90

    45                          50                     60                     88

    40                          50                     60                     90

    5                            50                     60                     88

    Power required

    Rate Min_age Max_age

    -The lower is age band 0_4

    45            0           4

    45            0           4

    40            0           4

    5              0           4

    -The lower is age band 5_20

    50            5           20

    50            5           20

    50            5           20

    50            5           20

    -The lower is age band 21_34

    60 21 34

    60 21 34

    60 21 34

    60 21 34

    -The lower is age band 35_44

    90 35 44

    88 35 44

    90 35 44

    88 35 44

    Rules

    -I have all the data in the rows each column online create separate lines and add 2 columns automatically Min_age and Max_age and insert the value on these columns based on the name of the column for example if the column name as age_0_4 then insert 0 in min_age and 4 in max_age means values for Min_age and Max_age extracted from the base of the column name. I don't know if it's possible or not, but I appreciate if someone can give me the solution for this problem... Do you like answers. Thank you


    Hello

    I'm not 100% sure what you want.  Do you want 16 production lines at a time, which is 4 lines of output for each line that is actually in the table?

    This looks like a job for the UNPIVOT operator:

    SELECTION rate

    min_age

    Case min_age

    WHEN 0 THEN 4

    WHEN 5 THEN 20

    WHEN 21 AND 34

    WHEN 35 THEN 44

    END AS max_age

    Of age_rate

    UNPIVOT (rate

    FOR min_age IN (age_0_4 0)

    age_5_20 AS 5

    age_21_34 AS 21

    age_35_44 AS 35

    )

    )

    ORDER BY min_age

    ;

  • The value of xml type column in oracle database 11 g 2

    I have a table containing columns XMLtype as 'XML_TABLE (ID NUMBER, donnees_xml XMlTYPE).

    Then I insert a value such as

    INSERT INTO xml_table (1, XMLtype('<current>
          <city id="2643743" name="London">
            <coord lon="-0.13" lat="51.51"/>
            <country>GB</country>
            <sun rise="2015-03-04T06:38:20" set="2015-03-04T17:46:01"/>
          </city>
          <temperature value="280.71" min="280.15" max="281.15" unit="kelvin"/>
          <humidity value="77" unit="%"/>
          <pressure value="1029" unit="hPa"/>
        </current>'));
    


    Now, I want to ask about this table. I can easily choose 'country' with the following query

    select t.xml_data.extract('/current/city/country/text()').getStringVal() "XML Data"
    from xml_table t;
    

    But I can't select the value of the temperature by this query. Now how to select the value of the temperature of the table?

    EXTRACT, EXTRACTVALUE etc are deprecated in 11.2.

    Use instead the XQuery functions.

    If you need to retrieve several values, XMLTABLE will be good:

    SQL> alter session set nls_numeric_characters = ".,";
    
    Session altered.
    
    SQL>
    SQL> select x.*
      2  from xml_table t
      3     , xmltable(
      4         '/current'
      5         passing t.xml_data
      6         columns country     varchar2(10) path 'city/country'
      7               , temperature number       path 'temperature/@value'
      8       ) x
      9  ;
    
    COUNTRY    TEMPERATURE
    ---------- -----------
    GB              280.71
    
  • Divide the values of a single column into multiple values of columns

    I want that the values of the "col_val" column to divide into several values in the column

    Table1:

    Col_val Col1, Col2

    Code1 POINT 45

    L2 AB 45

    L1 POINT 45 OF

    Code2 CAB 61

    ABC 51 LABORATORY

    SSS LAB 45

    QQQ BED 123

    BBV COT 100

    FFF COT 444

    Output as expected:

    OUT1 out2 out3-out4, out5

    Code1 AB SSS

    L1

    Code2

    ABC

    QQQ

    BBV

    FFF

    Each line must contain the values corresponding to the Col2 values and each column must have the values in Col1, as illustrated above.

    SQL> with t
      2  as
      3  (
      4  select 'Code1' col_val, 'ITEM' col1, 45 col2
      5    from dual
      6  union all
      7  select 'L2' col_val, 'AB' col1, 45 col2
      8    from dual
      9  union all
     10  select 'L1' col_val, 'ITEM' col1, 45 col2
     11    from dual
     12  union all
     13  select 'Code2' col_val, 'CAB' col1, 61 col2
     14    from dual
     15  union all
     16  select 'ABC' col_val, 'LAB' col1, 51 col2
     17    from dual
     18  union all
     19  select 'SSS' col_val, 'LAB' col1, 45 col2
     20    from dual
     21  union all
     22  select 'QQQ' col_val, 'COT' col1, 123 col2
     23    from dual
     24  union all
     25  select 'BBV' col_val, 'COT' col1, 100 col2
     26    from dual
     27  union all
     28  select 'FFF' col_val, 'COT' col1, 444 col2
     29    from dual
     30  )
     31  select max(col1)
     32       , max(col2)
     33       , max(col3)
     34       , max(col4)
     35       , max(col5)
     36    from (
     37            select decode(col1, 'ITEM', col_val) col1
     38                 , decode(col1, 'AB'  , col_val) col2
     39                 , decode(col1, 'LAB' , col_val) col3
     40                 , decode(col1, 'CAB' , col_val) col4
     41                 , decode(col1, 'COT' , col_val) col5
     42                 , t.col2 col_2
     43                 , row_number() over(partition by col2, col1 order by 1) rno
     44              from t
     45         )
     46   group
     47      by col_2, rno
     48   order
     49      by col_2;
    
    MAX(C MAX(C MAX(C MAX(C MAX(C
    ----- ----- ----- ----- -----
    Code1 L2    SSS
    L1
                ABC
                      Code2
                            BBV
                            QQQ
                            FFF
    
    7 rows selected.
    
    SQL>
    
  • I want to loop through the data from two different tables using for loop where the query should be replaced at runtime, please help me

    I have the data into two table with the structure of similar column, I want to loop through the data in these two tables

    based on some condition and runtime that I want to put the query in loop for example, the example is given, please help me

    create table ab (a number, b varchar2 (20));

    Insert into ab

    Select rownum, rownum. "" sample "

    of the double

    connect by level < = 10

    create table bc (a number, b varchar2 (20));

    Insert into BC.

    Select rownum + 1, rownum + 1 | "" sample "

    of the double

    connect by level < = 10

    declare

    l_statement varchar2 (2000);

    Boolean bool;

    Start

    bool: = true;

    If it is true, then

    l_statement: =' select * ab ';

    on the other

    l_statement: =' select * from bc';

    end if

    I'm in execute immediate l_statement - something like that, but I don't know

    loop

    dbms_output.put_line (i.a);

    end loop;

    end;

    Something like that, but this isn't a peace of the code work.

    Try this and adapt according to your needs:

    declare

    l_statement varchar2 (2000);

    c SYS_REFCURSOR;

    l_a number;

    l_b varchar2 (20);

    Boolean bool;

    Start

    bool: = true;

    If it is true, then

    l_statement: = "select a, b, AB;

    on the other

    l_statement: = "select a, b from bc;

    end if;

    --

    Open c for l_statement;

    --

    loop

    extract the c in l_a, l_b;

    When the output c % notfound;

    dbms_output.put_line (l_a |') -' || l_b);

    end loop;

    close c;

    end;

    /

  • Set the value from one point to another element at run time

    Hello

    I use APEX 4.2

    My question is on the same page, we form another, I create two region region html

    I'm filling out the form and press on create button then the value created by primary key must be in

    page HTML element area (whereas it only displays in editable form mode)

    I want after click on create region html button get refreshed and value should appear displaying the only element of the page

    any idea?

    Thank you

    go

    Hi, go,

    I modified your page, I just created the sub process of PL/SQL after the presents.

    Start

    Select empno in: P3_EMPNO from emp where ename =: P3_ENAME;

    END;

    It assigns the value to point P3_EMPNO and session as well. Initially the P3_EMPNO point value is not inserted into the session.

    Please check and let me know.

    Thank you

    Lacombe

  • Insert the value from the date of the operation, max

    Hello

    We use oracle 10g R2 on windows.

    I want to insert values from one table to the other. Suppose I have a table emp (empcode, salary, dt_update) and have another table emp_live (empcode, salary).

    data into the emp table are as
    EMPCODE     SALARY     DT_UPDATE
    
    281G     10611230.319     10/9/2010 6:38:30 PM
    281G     37819399.457     10/8/2010 6:38:30 PM
    291G     16500012.429     10/10/2010 6:38:30 PM
    291G     108145595.738     10/9/2010 6:38:30 PM
    292G     79449005.406     10/11/2010 6:38:30 PM
    292G     198819948.865     10/10/2010 6:38:30 PM
    293E     4532332.618     10/12/2010 6:38:30 PM
    293E     142572824.216     10/11/2010 6:38:30 PM
    294D     116505728.748     10/13/2010 6:38:30 PM
    294D     90087585.925     10/12/2010 6:38:30 PM
    My requirement is to insert only those records where the maximum date of DT_UPDATE.

    In the above senario only records below need to obtain insert
    EMPCODE     SALARY     DT_UPDATE
    281G     10611230.319     10/9/2010 6:38:30 PM
    291G     16500012.429     10/10/2010 6:38:30 PM
    292G     79449005.406     10/11/2010 6:38:30 PM
    293E     4532332.618     10/12/2010 6:38:30 PM
    294D     116505728.748     10/13/2010 6:38:30 PM
    I am trying to insert it as
    insert into emp_live select empcode,salary from emp where dt_update=(select max(dt_update) from emp)
    But above not giving not correct results beacase when I select the records as
    select empcode,max(dt_update) from emp group by empcode
    Above shows 1665 records, but when I am inserting only insert 16 records.

    Help, please.

    Something like this:

    create table test (empcode varchar2 (4), salary number, date of dt_update);
    Insert test values (' ' 281 G ", 10611230.319, to_date (October 9, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
    Insert test values (' ' 281 G ", 37819399.457, to_date (October 8, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
    Insert test values (' ' 291 G ", 16500012.429, to_date (October 10, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
    Insert test values (' ' 291 G ", 108145595.738, to_date (October 9, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
    Insert test values (' ' 292 G ", 79449005.406, to_date (October 11, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
    Insert test values (' ' 292 G ", 198819948.865, to_date (October 10, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
    insert into test values ('293E', 4532332.618, to_date (October 12, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
    insert into test values ('293E', 142572824.216, to_date (October 11, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
    Insert test values ('294, 116505728.748, to_date (October 13, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
    Insert test values ('294, 90087585.925, to_date (October 12, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))

    SQL> column salary for 99999999999.9999;
    SQL> select * from test;
    
    EMPC            SALARY DT_UPDATE
    ---- ----------------- ---------
    281G     10611230.3190 09-OCT-10
    281G     37819399.4570 08-OCT-10
    291G     16500012.4290 10-OCT-10
    291G    108145595.7380 09-OCT-10
    292G     79449005.4060 11-OCT-10
    292G    198819948.8650 10-OCT-10
    293E      4532332.6180 12-OCT-10
    293E    142572824.2160 11-OCT-10
    294D    116505728.7480 13-OCT-10
    294D     90087585.9250 12-OCT-10
    
    10 rows selected.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  select min(empcode),max(salary),max(dt_update)
      2  from test
      3  group by empcode
      4* order by 1
    SQL> /
    
    MIN( MAX(SALARY) MAX(DT_UP
    ---- ----------- ---------
    281G  37819399.5 09-OCT-10
    291G   108145596 10-OCT-10
    292G   198819949 11-OCT-10
    293E   142572824 12-OCT-10
    294D   116505729 13-OCT-10
    
    SQL> insert into test
      2  (
      3  select min(empcode) empcode,max(salary) salary,max(dt_update) dt_update
      4  from test
      5  group by empcode
      6  )
      7  /
    
    5 rows created.
    
    SQL> select * from test;
    
    EMPC            SALARY DT_UPDATE
    ---- ----------------- ---------
    281G     10611230.3190 09-OCT-10
    281G     37819399.4570 08-OCT-10
    291G     16500012.4290 10-OCT-10
    291G    108145595.7380 09-OCT-10
    292G     79449005.4060 11-OCT-10
    292G    198819948.8650 10-OCT-10
    293E      4532332.6180 12-OCT-10
    293E    142572824.2160 11-OCT-10
    294D    116505728.7480 13-OCT-10
    294D     90087585.9250 12-OCT-10
    281G     37819399.4570 09-OCT-10
    
    EMPC            SALARY DT_UPDATE
    ---- ----------------- ---------
    293E    142572824.2160 12-OCT-10
    294D    116505728.7480 13-OCT-10
    291G    108145595.7380 10-OCT-10
    292G    198819948.8650 11-OCT-10
    
    15 rows selected.
    
    SQL>
    

    Concerning
    Girish Sharma

Maybe you are looking for