How to group similar values using XQuery

I have a table Employee with following columns
EmpNo number,
Title varchar2(100),
First_Name varchar2(100),
Last_Name varchar2(100),
1, Miss, A, B (Sample record in Employee Table)
There is an audit table Employee_A with columns
ID number (PK),
EmpNo number,
Field_Name varchar2(100),
Old_Value varchar2(100),
New_Value varchar2(100)
An update statement causes the Title of EmpNo=1 to change from Miss to Mrs and Last_Name from B to C. Hence the audit table has two records
1,1,Title, Miss,Mrs
2,1,Last_Name, B, C
I need to generate an xml which is as follows:
<Tag>
<Operation>Update</Operation>
<Key>1</Key>
<Data>
<Field>
<Column>Title</Column>
<NewValue>Mrs</NewValue>
</Field>
<Field>
<Column>Last_Name</Column>
<NewValue>C</NewValue>
</Field>
<Data>
</Tag>
How can we do this using XQuery?
If not, can we do this using xmlelement, xmlagg?

I tried the following:
SELECT XMLQuery('<Dummy>
{for $c in ora:view("Employee"),
           $ca in ora:view("Employee_A")
       let $emp := $c/ROW/EMPNO/text(),
           $emp_a := $ca/ROW/EMPNO/text(),
           $field := $ca/ROW/FIELD_NAME/text(),
           $new := $ca/ROW/NEW_VALUE/text()
           where $emp = $emp_a
       return
       <Tag>
         <operation>Update</operation>
         <key_id>$emp_a</key_id>
         <Data>
         <Field>
           <Column>{$field}</ent_id>
<NewValue>{$new}</NewValue>
</Field>
</Data>
</Tag>
}</Dummy' RETURNING CONTENT)
FROM dual;
The output that I'm getting is
<Dummy
<Tag>
<Operation>Update</Operation>
<Key>1</Key>
<Data>
<Field>
<Column>Title</Column>
<NewValue>Mrs</NewValue>
</Field>
<Data>
</Tag>
<Tag>
<Operation>Update</Operation>
<Key>1</Key>
<Data>
<Field>
<Column>Last_Name</Column>
<NewValue>C</NewValue>
</Field>
<Data>
</Tag>
</Dummy>
Two <Tag></Tag> gets created - one for each update entry. Please help

Similar Messages

  • How to find report values using report writer

    hi,
    Please help me.
    How to find report values using report writer
    Regards,
    RRK.
    Edited by: Alvaro Tejada Galindo on Feb 6, 2008 12:01 PM

    Thanks all for the reply.
    I am trying to solve a problem where report parameter value that is set at Management Console is wiped out after calling replaceConnection.
    databaseController.replaceConnection(oldConnectionInfo, newConnectionInfo,
    null,DBOptions._doNotVerifyDB);
    We have to support changing database connection from a java utility
    class. But once replaceConnection is called all existing static parameter values are lost. To fix this issue we thought of getting parameters and values before calling replaceConnection and setting it after replaceConnection.
    Version is CS2008 SP3 - version 12.3.0.601
    If there is any other option of fixing the original wipe out issue?
    ParameterValues.getValues() didn't return value. I will try ParameterValues.getCurrentCalues() but the document says ParameterValues.getValues() is  equivalent to the IParameterField.getCurrentValues() method  unless it is empty, in which case it is equivalent  to the IParameterField.getDefaultValues() method.
    So getCurrentValues() may not work.

  • How to group table rows using GroupedColumn?

    Hi all,
    i know by binding the grouping value to a context, it can merge rows into one. but this only works if the two rows are adjacent.
    if the context looks like this:
    value 1
    value 2
    value 1
    value 2
    it can not group them together
    how to group them together and merge the rows?
    thanks.

    Hi erv,
    U need to use the TableSorter class for this.
    You can download the TableSorter.java class from the tutorial Working with Tables in Web Dynpro.
    Here you can select the project A) Creating Tables and download the Ready-to-use project. The lick to download project is:
    [/docs/DOC-8061#46|/docs/DOC-8061#46]
    Once you have downloaded the tutorial, you can find the TableSorter.java class in this path
    TutWD_Table/src/packages/com/sap/tc/webdynpro/tests/utils
    For more information refer to this blog:
    [Enhanced Web Dynpro Java TableSorter for SAP NetWeaver 04s|/docs/DOC-8061#46]
    Regards,
    Sayan Ghosh

  • How to get multiple values using HttpSession.getAttribute(java.lang.String)

    Hey Guys
    I'm trying to find a way to get multiple values using the following method
    HttpSession.getAttribute(java.lang.String)
    Here's the scenerio. Its a already written application and now i'm trying to make some changes. earlier in the jsp page a combo box was used and value was retrieved in the servlet using the getAttribute method of Session. Now I'm using a html multiple selection list and have to retrieve all the values selected in the list in the servlet. Can anyone please suggest me how to do that. HTTPRequest class has a method getParameterValues which will let me do that but i have to do is using HTTPSession.
    Thanks for your time to read this

    I'm not sure what you are trying to do. You can only use session.getAttribute to retrieve something that has already been stored in the session with a previous setAttribute. If you need to store multiple values under one attribute name using setAttribute, you can store an array, or an ArrayList or whatever type of Collection you want. The request.getParameterValues method is the only way you can retrieve form parameters than can have multiple values. If the servlet hasn't already processed these parameters and put them into the session for you, you have to use request.getParameterValues.

  • How to group these values month by month ?

    Hi,
    I have a nice SQL statement which returns days by days, the values of a device.
    WITH S1 AS
      (SELECT DATE1,
        ROUND(AVG(VALEUR),2) Debit
         FROM EVV_E032
        WHERE DATE1 BETWEEN TO_DATE('01012006000000', 'DDMMYYYYHH24MISS') AND TO_DATE('31122006235959', 'DDMMYYYYHH24MISS')
      AND CLEF_VAR =
        (SELECT CLEF_VAR FROM SITE_DEBIT_RIVIERE WHERE SITE = 'E032'
    GROUP BY date1
    SELECT NULL LINK    ,
      TO_CHAR(n, 'DD.MM'),
      NVL(ROUND(AVG(Debit),2), 0) "Débit"
       FROM
      (SELECT TRUNC(TRUNC(to_date(2006,'YYYY'),'year'), 'DD')-1 + level n,
        rownum jours
         FROM dual CONNECT BY level<=366
      ) days
    LEFT JOIN s1
         ON days.n = TRUNC(date1,'DD')
    GROUP BY n
    ORDER BY nSample values :
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('10/02/2006 09:49:59','DD/MM/YYYY HH24:MI:SS') 1,63);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('21/02/2006 10:35:12','DD/MM/YYYY HH24:MI:SS') 1,68);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('21/02/2006 11:30:30','DD/MM/YYYY HH24:MI:SS') 0);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('23/02/2006 14:02:02','DD/MM/YYYY HH24:MI:SS') 0);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('23/02/2006 16:22:34','DD/MM/YYYY HH24:MI:SS') 0);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('30/04/2006 18:09:08','DD/MM/YYYY HH24:MI:SS') 1,72);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('20/05/2006 11:57:02','DD/MM/YYYY HH24:MI:SS') 1,72);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('07/06/2006 15:11:58','DD/MM/YYYY HH24:MI:SS') 1,79);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('08/06/2006 20:00:26','DD/MM/YYYY HH24:MI:SS') 1,82);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('19/06/2006 09:42:32','DD/MM/YYYY HH24:MI:SS') 1,72);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('20/06/2006 04:30:00','DD/MM/YYYY HH24:MI:SS') 1,82);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('20/06/2006 10:39:01','DD/MM/YYYY HH24:MI:SS') 1,72);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('24/06/2006 19:34:50','DD/MM/YYYY HH24:MI:SS') 1,82);
    Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('26/06/2006 14:37:26','DD/MM/YYYY HH24:MI:SS') 1,88);The output are values grouped day by day. I would like to group tehse values month by month, but could not figure how to do. Even though I am not a newbie newbie on SQL, this code is going far too much for me. I know some of you guys can handle this. I tried hard but coud not succeed. Could you help me ?
    Regards, Christian.

    Difficult to work out (read: too much hassle) with your data and sql, as you haven't provided a set of info for all the tables provided, but hopefully this will give you an idea:
    with my_tab as (select trunc(sysdate)+30 dt, 1 val from dual union all
                    select trunc(sysdate) dt, 2 val from dual union all
                    select trunc(sysdate) dt, 20 val from dual union all
                    select trunc(sysdate)+30 dt, 10 val from dual union all
                    select trunc(sysdate)+60 dt, 6 val from dual)
    -- end of mockup of table "my_tab"; see SQL below...
    select trunc(dt, 'mm') dt, sum(val)
    from   my_tab
    group by trunc(dt, 'mm')
    order by trunc(dt, 'mm');
    DT          SUM(VAL)
    01-MAR-09         22
    01-APR-09         11
    01-MAY-09          6

  • How to get year value using regular expression

    Hi,
    I have a different format of date such as 2004-01-03, 2003/01, 05/06/2005, 06-05-2007
    How can I get only the year value using regular expression? The year value is always in 4 digits
    Thanks in advance

    sabre150 wrote:
    JosAH wrote:
    \d{4}Is this the Jos I knew who poured scorn on anything to do with regex? Is this the Jos I knew who said that the 'pimping lemon' stopped regex being of any real use?It wasn't me; honest, I'm innocent: one of my parrots walked over my keyboard; I wouldn't be able to type such nonsense; naughty parrot! No cookie!
    kind regards,
    Jos
    ps. regexes can only survive the baby-pumping-lemma; they all die a horrible death with the real-men-pumping lemma! So there.

  • How to swap column values using variable in sql?

    Hi,
    I have a table and i want to swap two column values using variable
    please help me

    Hi,
    Let us assume that the DeptNAME and DeptNo columns are of type VARCHAR2. However, DeptNO column is VARCHAR2(10) and DeptNAMe is VARCHAR2(100).
    First of all DeptNo column needs to be modified to be 100.
    i) ALTER TABLE DEPT MODIFY DEPTNO VARCHAR2(100);
    Secondly, you will swap DEPTNAME and DEPTNO values using the SQL as follows:
    ii) update dept t1
    set deptname = (select deptno from dept2 t2 where t1.deptno = t2.deptno),
    deptno = (select deptname from dept2 t2 where t1.deptno = t2.deptno);
    Now, finally you want the deptname columns to be VARCHAR2(10)
    iii) ALTER TABLE DEPT MODIFY DEPTNAME VARCHAR2(10).
    If DEPTNO is a NUMBER column, you cannot alter the datatype unless the table is empty; in that case the whole swapping requirement would be moot.
    Trinath Somanchi,
    ( http://www.myospages.com )

  • HOW TO FILTER DIM VALUES USING LEVEL PARAMETER SCREEN BEFORE PRESENTATION

    hello,
    sorry but i did not understand your question - i don't know which objects is
    the "Descriptor". Let me try to update you with some facts and a better example
    of the situation - i will be also uploading some screen shots.
    from the jdeveloper help we found the topic "Specifying the action for a step
    object" which is very similar to what we want to perform. here follows the text
    and also some comments from us:
    Example: Using step actions Assume that a selection consists of the following
    two steps:
    Step A specifies the members: Boston, Chicago, and Denver
    (comment: in our problem, step A is a selection of customers performed using
    one of the 2 hierarchies of Customer dimension)
    Step B specifies the members: Boston and Austin
    (comment: in our problem, step B is another selection of customers performed
    using the other hierarchy of Customer dimension)
    Step B follows Step A.
    The following list shows how the results of this selection differ depending
    on the action that is
    specified for Step B:
    Step B action: SELECT -- Result: Boston and Austin (that is, only B is
    included)
    Step B action: ADD -- Result: Boston, Chicago, Denver, and Austin (that is,
    the union of A and B is included)
    Step B action: KEEP -- Result: Boston (that is, only members that are common
    to both A and B are kept; also referred to as the intersection of A and B)
    (comment: This is what we expect to have - the intersection of both customer
    dimension selections goes to the row edge of the presentation)
    Step B action: REMOVE -- Result: Chicago and Denver (that is, any members in
    B are removed from the current selection )
    how do i obtain this intersection ? is it possible to use this selection
    combining both hierarchies ?
    Please refer to the screen i will upload - it is the filter we need to apply.
    the customer dimension has 2 levels above the leaf records in one hierarchy,
    called "SETOR" and "ROTA" , and 3 levels in the other hierarchy, called
    "SEGMENTO" , "CANAL" and "SUBCANAL"
    thanks in advance

    Hi Prasad,
    I got your note, you should not use Session variable syntax to call presentation variable.
    you should use like @{AIC_PROJ_PLAT_SEQ_NO}
    One more thing: first test the variable AIC_PROJ_PLAT_SEQ_NO value then try to pass to SP.
    Hope this helps

  • How to "group by" and use functions on grouped records

    I group rows and wantto select the max date row in date column. The other columns can include same data in its rows, thus i wantto select distinct data in the rows. I use the following query, but ir throws the message "ORA-00936: missing expression."
    select max(t2.tarih), distinct (t1.ihlkodu),distinct(t1.ihlaltktgkodu), distinct(t1.kuladi),distinct(t4.ad) from ihale_katilimcilar t1, ihale_hareket t2, ihale_sirket t4
    where t1.id_iliski=t2.id_iliski and t1.kuladi=t4.kullaniciadi and t1.ihlkodu=145 and t1.ihlaltktgkodu=135 and t1.aktif=1
    group by t2.tarih, t1.ihlkodu,t1.ihlaltktgkodu,t1.kuladi,t4.ad
    Here t2.tarih is a field of date and i wantto select the max of this.
    t1.ihlkodu has all the same data in its rows.
    t1.ihlaltktgkodu too has all the same data in its rows.
    t1.kuladi may have ,let me say, 5 rows of same data and 6 rows of another same data in this 6 but different then the first 5 rows of same data. That is, the content of the 6 and 5 is the same in 6 and 5 but different then each other.
    and finally[b] t4.ad too may have ,let me say, 5 rows of same data and 6 rows of another same data in this 6 but different then the first 5 rows of same data.(That is, the content of the 6 and 5 is the same in 6 and 5 but different then each other)
    How could i group them?

    Here is the script of tables:
    -- Create table
    create table IHALE_SIRKET
    SRKTKODU NUMBER not null,
    AD VARCHAR2(30) not null,
    ADRES VARCHAR2(50),
    TEL1 VARCHAR2(15),
    TEL2 VARCHAR2(15),
    FAX VARCHAR2(15),
    EMAIL VARCHAR2(20),
    KARALISTE NUMBER default -1,
    AKTIF NUMBER(1) default -1,
    SICILNO VARCHAR2(20) not null,
    VERGINO VARCHAR2(20) not null,
    TICSICILGAZSAYI VARCHAR2(10) not null,
    TICSICILGAZTARIH DATE not null,
    ODASICILNO VARCHAR2(20),
    TESCILTARIHI DATE,
    SERMAYE VARCHAR2(20),
    DERECE NUMBER(2),
    ODAKAYITTARIHI DATE,
    KULLANICIADI VARCHAR2(15)
    tablespace USERS
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    initial 64K
    minextents 1
    maxextents unlimited
    -- Create/Recreate primary, unique and foreign key constraints
    alter table IHALE_SIRKET
    add constraint CONSTRAINT_SRKTKODUPK primary key (SRKTKODU);
    -- Create/Recreate indexes
    create unique index IHALE_SIRKET_SRKTKODU on IHALE_SIRKET (SRKTKODU)
    tablespace USERS
    pctfree 10
    initrans 2
    maxtrans 255
    storage
    initial 64K
    minextents 1
    maxextents unlimited
    -- Create table
    create table IHALE_KATILIMCILAR
    KULADI VARCHAR2(20),
    SONUC NUMBER(1),
    AKTIF NUMBER(1) default 1,
    SRKTKODU VARCHAR2(10) not null,
    SONBULUNMAZAMANI DATE default sysdate,
    SIRA NUMBER(1) default 0,
    EKSURETALEP VARCHAR2(50),
    ID NUMBER(6) not null,
    IHLKODU NUMBER not null,
    IHLALTKTGKODU VARCHAR2(10) not null,
    ID_ILISKI NUMBER
    tablespace USERS
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    initial 64K
    minextents 1
    maxextents unlimited
    -- Create/Recreate primary, unique and foreign key constraints
    alter table IHALE_KATILIMCILAR
    add constraint CONSTRAINT_IHLKTLMIDPK primary key (ID)
    using index
    tablespace USERS
    pctfree 10
    initrans 2
    maxtrans 255
    storage
    initial 64K
    minextents 1
    maxextents unlimited
    -- -- -- Create table
    create table IHALE_HAREKET
    ID_ILISKI NUMBER not null,
    TEKLIF VARCHAR2(15) not null,
    TARIH DATE default sysdate,
    ID NUMBER not null
    tablespace USERS
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    initial 64K
    minextents 1
    maxextents unlimited
    -- Create/Recreate primary, unique and foreign key constraints
    alter table IHALE_HAREKET
    add constraint CONSTRAINT_IHLHAREKETPK primary key (ID)
    using index
    tablespace USERS
    pctfree 10
    initrans 2
    maxtrans 255
    storage
    initial 64K
    minextents 1
    maxextents unlimited
    Here is the content of those tables:
    prompt Loading IHALE_HAREKET...
    insert into IHALE_HAREKET (ID_ILISKI, TEKLIF, TARIH, ID)
    values (189, '1400YTL', to_date('12-02-2008 14:35:07', 'dd-mm-yyyy hh24:mi:ss'), 1);
    insert into IHALE_HAREKET (ID_ILISKI, TEKLIF, TARIH, ID)
    values (203, '1200YTL', to_date('12-02-2008 16:03:16', 'dd-mm-yyyy hh24:mi:ss'), 2);
    insert into IHALE_HAREKET (ID_ILISKI, TEKLIF, TARIH, ID)
    values (203, '1100YTL', to_date('12-02-2008 16:03:16', 'dd-mm-yyyy hh24:mi:ss'), 3);
    insert into IHALE_HAREKET (ID_ILISKI, TEKLIF, TARIH, ID)
    values (189, '1500 YTL', to_date('12-02-2008 14:34:30', 'dd-mm-yyyy hh24:mi:ss'), 0);
    prompt 4 records loaded
    prompt Loading IHALE_KATILIMCILAR...
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '42', to_date('12-02-2008 13:33:32', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 63, 141, '134', 191);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '46', to_date('12-02-2008 13:33:32', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 64, 141, '134', 192);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values ('KEM.ESM', null, 1, '44', to_date('12-02-2008 11:00:41', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 61, 145, '135', 189);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '45', to_date('12-02-2008 13:33:42', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 69, 141, '133', 197);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '42', to_date('12-02-2008 13:33:36', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 65, 141, '132', 193);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '45', to_date('12-02-2008 13:33:36', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 66, 141, '132', 194);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '46', to_date('12-02-2008 13:33:36', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 67, 141, '132', 195);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '42', to_date('12-02-2008 13:33:42', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 68, 141, '133', 196);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '44', to_date('12-02-2008 13:34:23', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 70, 142, '252', 198);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '45', to_date('12-02-2008 13:34:23', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 71, 142, '252', 199);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '44', to_date('12-02-2008 13:34:40', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 72, 143, '253', 200);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '46', to_date('12-02-2008 13:34:40', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 73, 143, '253', 201);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '45', to_date('12-02-2008 11:00:38', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 60, 145, '136', 188);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values (null, null, 0, '44', to_date('12-02-2008 15:59:21', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 74, 145, '136', 202);
    insert into IHALE_KATILIMCILAR (KULADI, SONUC, AKTIF, SRKTKODU, SONBULUNMAZAMANI, SIRA, EKSURETALEP, ID, IHLKODU, IHLALTKTGKODU, ID_ILISKI)
    values ('KE.ES', null, 1, '45', to_date('12-02-2008 15:59:25', 'dd-mm-yyyy hh24:mi:ss'), 0, null, 75, 145, '135', 203);
    commit;
    prompt 15 records loaded
    prompt Loading IHALE_SIRKET...
    insert into IHALE_SIRKET (SRKTKODU, AD, ADRES, TEL1, TEL2, FAX, EMAIL, KARALISTE, AKTIF, SICILNO, VERGINO, TICSICILGAZSAYI, TICSICILGAZTARIH, ODASICILNO, TESCILTARIHI, SERMAYE, DERECE, ODAKAYITTARIHI, KULLANICIADI)
    values (42, 'KEMMM', 'asddd', '03123456444', '03123456444', '03123456444', '[email protected]', 0, 1, '325999444', '234999444', '34599944', to_date('04-02-2008', 'dd-mm-yyyy'), '23/29444', to_date('04-02-2008', 'dd-mm-yyyy'), '4.000.000.11YTL', 1, to_date('04-02-2008', 'dd-mm-yyyy'), null);
    insert into IHALE_SIRKET (SRKTKODU, AD, ADRES, TEL1, TEL2, FAX, EMAIL, KARALISTE, AKTIF, SICILNO, VERGINO, TICSICILGAZSAYI, TICSICILGAZTARIH, ODASICILNO, TESCILTARIHI, SERMAYE, DERECE, ODAKAYITTARIHI, KULLANICIADI)
    values (46, 'MLK', 'fgh', '456', '456', '456', '[email protected]', 0, 1, '2346', '2346', '2346', to_date('27-01-2008', 'dd-mm-yyyy'), '2346', to_date('25-01-2008', 'dd-mm-yyyy'), '2346', 1, to_date('22-01-2008', 'dd-mm-yyyy'), null);
    insert into IHALE_SIRKET (SRKTKODU, AD, ADRES, TEL1, TEL2, FAX, EMAIL, KARALISTE, AKTIF, SICILNO, VERGINO, TICSICILGAZSAYI, TICSICILGAZTARIH, ODASICILNO, TESCILTARIHI, SERMAYE, DERECE, ODAKAYITTARIHI, KULLANICIADI)
    values (44, 'ASD', 'asd', '123', '123', '123', '[email protected]', 0, 1, '123', '123', '123', to_date('10-01-2008', 'dd-mm-yyyy'), '123', to_date('17-01-2008', 'dd-mm-yyyy'), '123', 1, to_date('11-01-2008', 'dd-mm-yyyy'), 'KEM.ESM');
    insert into IHALE_SIRKET (SRKTKODU, AD, ADRES, TEL1, TEL2, FAX, EMAIL, KARALISTE, AKTIF, SICILNO, VERGINO, TICSICILGAZSAYI, TICSICILGAZTARIH, ODASICILNO, TESCILTARIHI, SERMAYE, DERECE, ODAKAYITTARIHI, KULLANICIADI)
    values (45, 'JKL', 'jkl', '234', '234', '345', '[email protected]', 0, 1, '234', '234', '234', to_date('04-01-2008', 'dd-mm-yyyy'), '234', to_date('27-01-2008', 'dd-mm-yyyy'), '234', 2, to_date('19-01-2008', 'dd-mm-yyyy'), 'KE.ES');
    When i use the following sql:
    select t2.teklif, t2.tarih, t1.ihlkodu, t1.ihlaltktgkodu, t1.kuladi,t4.ad from ihale_katilimcilar t1, ihale_hareket t2, ihale_sirket t4
    where t1.id_iliski=t2.id_iliski and t1.kuladi=t4.kullaniciadi and t1.ihlkodu=145 and t1.ihlaltktgkodu=135 and t1.aktif=1
    group by t2.teklif, t2.tarih, t1.ihlkodu,t1.ihlaltktgkodu,t1.kuladi,t4.ad
    The result i get is:
    1100YTL 12.02.2008 16:08:16 145 135 KE.ES JKL ***
    1200YTL 12.02.2008 16:03:16 145 135 KE.ES JKL
    1400YTL 12.02.2008 14:35:07 145 135 KEM.ESM ASD ***
    1500 YTL 12.02.2008 14:34:30 145 135 KEM.ESM ASD
    The one i wantto get is the rows of the latest date in each group:
    1100YTL 12.02.2008 16:08:16 145 135 KE.ES JKL [b]***
    1400YTL 12.02.2008 14:35:07 145 135 KEM.ESM ASD ***
    max date -->latest date , most up to date
    Message was edited by:
    user611878
    Message was edited by:
    kem06.ora

  • How to Group itab values....

    Hi Experts,
    I have created  a report and inserted into itab. The values are
    Matkl      Pend.Qty.  Pend Value.
    =========================
    SPG           5              100.00
    SPG          3               300.00
    SRG          2              300.00
    SRG          7              800.00
    Now i want to group matkl and total of Pendqty & value into another table.
    How to do that.
    Pl. give some idea.
    Yusuf

    HI,
    DATA: itab type table of <your table> with key MATKL.
    Now use.
    COLLECT wa into ITAB.
    COLLECT sums up all the numeric fields of the table if the KEY's of the records are same.
    SO when push a WOrkarea into a table using PUSH if there exists a record with the key it just adds the value that is there in the workarea to the record.
    Example:
    DATA: BEGIN OF seats,
            carrid   TYPE sflight-carrid,
            connid   TYPE sflight-connid,
            seatsocc TYPE sflight-seatsocc,
          END OF seats.
    DATA seats_tab LIKE HASHED TABLE OF seats
                   WITH UNIQUE KEY carrid connid.
    SELECT carrid connid seatsocc
           FROM sflight
           INTO seats.
      COLLECT seats INTO seats_tab.
    ENDSELECT.
    Regards,
    Sesh

  • How to group Similar Rows into One Row  ?? Suggestions??

    Hi there , I am having a problem in my project you see I have 2 dimensions in my cube called Username and Symbols and a measure called M1.
    You see in the Symbol dimension there is repeated data in multiple rows such as the following
    Pepsi
    Pepsi
    Pepsi
    CocalCola
    Now when i display the dimension Username with the dimension Symbol using the Measure value M1. I get something like this
    UserName A
    Pepsi---- 10
    Pepsi---- 10
    Pepsi---- 10
    CoacalCola--- 20
    Now in the above table UserNameA represents a member of Username Dimension and cold drinks represent members of the Symbol Dimension
    and the numarical value represents the measure M1.
    I want it to appear something like this
    UserName A
    Pepsi 30 (Notice The measures of Pepsi have been added)
    CocalCola 20
    Any idea on how i can accomplish this or tip i would be really thankful

    Hi
    Use the aggregator operator in mapping. You can use the SUM function on the columns you wish to sum for example, and group by the other columns.
    Cheers
    David

  • How to insert data values using Poplist to both block items....

    Hi,
    I have created a poplist which should return a sequence(which is stored in a db table) and a description .
    The sequence(stored in table) is of number datatype and the description is of varchar2.....
    I have created the required record group as:
    rg_id := Create_Group_From_Query('TEXNIKOS_GROUP', 'select eponymo , to_char(seq_code_ergazomenoy)
                                                           from ref_ergazomenos,ref_eidikothta
                                                           where ref_ergazomenos.code_eidikothtas_type_id=ref_eidikothta.seq_code_eidikothtas
                                                           order by 1');
       status := Populate_Group( rg_id );
       if (status = 0)
         then
          POPULATE_LIST('MOD2_KLISI_VLAVIS.TEXNIKOS_FNAME','TEXNIKOS_GROUP');
       end if;The field 'MOD2_KLISI_VLAVIS.TEXNIKOS_FNAME' is the description i described above ... and whereas this block item is filled with the selected poplist... the sequence - the code of the db table- is not.....
    Is it possible to do so.... ????
    NOTE: i use Dev10g.
    Many thanks,
    Simon

    I have two block items:
    seq_code_ergazomenoy: number datatype , db item , invisible
    eponymo:varchar2 datatype , non db item , visible
    How to fill these both block items using the written record group...?????
    Now , only the "eponymo" block item is filled but not the required "seq_code_ergazomenoy"....
    In other words.... is there any manner to do the column mapping of the two selected columns (in the dynamically created record group) to the two block items....????
    Thanks,
    Simon
    Message was edited by:
    sgalaxy

  • How to insert variable value using select statement - Oracle function

    Hi,
    I have a function which inserts record on basis of some condition
    INSERT INTO Case
    Case_ID,
    Case_Status,
    Closure_Code,
    Closure_Date
    SELECT newCaseID,
    caseStatus,
    Closure_Code,
    Closure_Date,
    FROM Case
    WHERE Case_ID = caseID
    Now i want new casestatus value in place of select statement caseStatus value. I have a variable m_caseStatus and i want to use the value of this variable in above select statement.
    how can i use this.
    thanks

    Hi,
    I have a function which inserts record on basis of some condition
    INSERT INTO Case
    Case_ID,
    Case_Status,
    Closure_Code,
    Closure_Date
    SELECT newCaseID,
    caseStatus,
    Closure_Code,
    Closure_Date,
    FROM Case
    WHERE Case_ID = caseID
    Now i want new casestatus value in place of select statement caseStatus value. I have a variable m_caseStatus and i want to use the value of this variable in above select statement.
    how can i use this. Do not select Case_Status from inner select, so null will be inserted then after inserting it update the case status with m_caseStatus.
    Regards.

  • Retrieve Distinct Values using XQuery

    The following query is returning me duplicate rows. How can we retrieve the distinct values? Can we use Distinct somewhere in this query? Please help me.
    SELECT XMLQuery('<Update>
    { for $demo in (ora:view("TableA")),
    $demo_audit in ora:view("TableA_AUDIT")
    let $demo_id := $demo/ROW/ID/text(),
    $demo_audit_trans_date := $demo_audit/ROW/DATE/text(),
    $demo_audit_id := $demo_audit/ROW/ID/text(),
    $demo_audit_type := $demo_audit/ROW/TYPE/text()
    where $demo_id = $demo_audit_id and
    $demo_audit_type = "U"
    return
    <result>
    <type>U</type>
    <id>{$demo_id}</id>
    </result>}</Data>' RETURNING CONTENT)
    FROM dual;

    Geoff,
    I tried distinct-values in both let and return; however the result isn't distinct. Is the usage correct?
    SELECT XMLQuery('<Update>
    {for   $a in ora:view("EMP")
           let   $a_empno         := distinct-values($a/ROW/EMPNO/text()),
                 $a_ename         := $a/ROW/ENAME/text(),
                 $a_job           := $a/ROW/JOB/text(),
                 $a_mgr           := $a/ROW/MGR/text(),
                 $a_deptno        := distinct-values($a/ROW/DEPTNO/text())
           return
           <op>
                 <empno>{distinct-values($a_empno)}</empno>
    <name>{$a_ename}</name>
    <deptno>{distinct-values($a_deptno)}</deptno>
    </op>}
    </Update>'
    RETURNING CONTENT)
    FROM dual;
    The output generated is given below:
    <Update>
    <op>
    <empno>1</empno>
    <name>Henry</name>
    <deptno>10</deptno>
    </op>
    <op>
    <empno>1</empno>
    <name>Henry1</name>
    <deptno>10</deptno>
    </op>
    </Update>

  • How to compare date values in XQuery

    begin
    select sysdate into x_date from dual;
    select xmlquery( '<A>
    { [b]for $a in ora:view("TableA")
    let $id = $a/ROW/ID/text()
    where $a/ROW/TRANS_DATE >= x_date
    return ..
    </A>' returning content}
    into temp from dual;
    end;
    This gives me invalid variable name. I hard code the date and it works fine. I tried xs:date also. Please help.

    You could use the XQuery function fn:current-dateTime iso trying to use a parameter.
    If you want to use an parameter with XQuery, they need to be nodes (not just atomic values) and have to passed using the passing clause.
    See the oracle doc for details and examples.
    Hth,
    Peter

Maybe you are looking for

  • Play CD music with lid closed

    Is it possible to play CD with lid closed without a external display plugged in? Assuming the MBP is connected to AC outlet, and Bluetooth mouse is present.

  • Opinion on utilizing/storing/managing excess music

    Hi - hopefully this is in the right area. I tried to search, but did not find anything relevant to my issue. I have a 4G 20GB iPod and currently have 27GB of music in iTunes. As my immediate collection grows, it's a constant challenge to uncheck 'vic

  • Need help consolidating.  Strange error message

    Hello, Trying to consolidate library to new external drive. Created file on new drive, pointed itunes there, hit consolidate. after 4.6 gig, it stopped and said not enough memory. 180 gig left on hard drive! tried again, and have since been getting "

  • Questions about Creative Cloud

    Hi I bought Lightroom 5 from a retail store maybe a year or so ago and I have had that set up on my computer and it serves me great and I love it. However it has come to my attention that I need photoshop as well. I'm a bit confused by the set up of

  • HTML to Flash linking

    Hi all, Maybe can someone help me with this. I have a webpage that is done in HTML. I need the links to direct into another site that is done in flash. The links from the HTML have to direct into particular movie clips in flash. Anyone know how to do