Display a column as row with same row names.

Hi,
My belwo query displaying o/p in this format.I need to conver a row with appriate colmn value (see the required o/p).
could some help.
current o/p
TEST_SESSION_ID       ROSTER_DOMAIN_NAME             TO_CHAR(A.SCORE)     SEM
4087               AR - Integers and Fractions     5.148757270620481     1
4087               AR - Decimal Numbers            5.5597596042656825     2required o/p format
TEST_SESSION_ID          AR - Integers and Fractions  AR - Decimal Numbers    sem-AR -                    sem
                                                                          Integers and Fractions    AR - Decimal Numbers
4087                  5.148757270620481             5.5597596042656825           1                   2ROSTER_DOMAIN_NAME are not staticks.I tcould be increase .some times it could have 20 names.Since i can t use decode or case with statically .can some one help on this.
query
SELECT a.test_session_id,c.roster_domain_name,to_char(a.score),a.sem FROM
      test_session_detail a,test_session b ,test_detail c
      WHERE a.test_session_id = b.test_session_id
      AND c.test_detail_id = a.test_detail_id
      AND exists (
      select td.test_detail_id
      from test_detail td
      where domain_map_id is not  null
      and c.test_detail_id =td.test_detail_id
      and domain_map_id in('303','306','305','304'))
      AND b.test_session_id in ('4087')
      AND domain_group_id NOT IN (
      SELECT domain_group_id
      FROM test_session_detail a,test_session b
      WHERE a.test_session_id = b.test_session_id
      AND a.domain_group_id is not null
      AND b.test_session_status_id = 4
      AND a.test_session_status_id <> 3
      AND b.test_session_id IN ('4087'))

Ok, the problem here is that you want a dynamic pivot of data and you also want to use some of the data as the column names.
SQL requires that the columns to be retrieved are known at query parse time, i.e. before any data is fetched, so it's not easily possible to have dynamic column names done in a single query.
The general steps in executing a query are...
1. Submit SQL query (Open Query)
2. SQL Query Parsed
3. SQL Query Executed
4. Row Fetched
5. Repeat step 4 until no more rows
6. Close QuerySo, as you can see no data is fetched until step 4, but, at Step 2, the SQL engine needs to have parsed the query and already know what columns and data types are going to be returned.
An example of how something similar can be achieved is given on this thread:
How to pipeline a function with a dynamic number of columns?
But that may be a little too complex to implement.
What you are really wanting is something at the front end reporting side of things.
Ideally, this is the task of a reporting tool, not of the SQL engine which is retrieving the data.

Similar Messages

  • Seperate Document Row with same account  when post GL

    Hello everyone
    How I can seperate Document Row with same account  when post GL
    because If I post dcoument that  have many rows but same account and difference detail. It will sum amount for same account in JE
    and I found that will seperate if it has diference project code but it's not enough for me.
    How I can config SAP B1 to seperate Doc row when post to JE if it has difference detail (as userfield or standard filed)
    Sorry for my poor english
    Thank,Seang

    Hello Suthee,
    Sorry to tell you, it is not possible to do so in current B1 without addon development.
    There are 2 alternative.
    1.Consulting Workaround:
    Seperate the Item into 2 items, the account into 2 sub accounts.e.g.
    Item A => Item A01 and A02
    G/L Account 1001 => Sub Account 100101 and 100102
    2.AddOn development to seperate the JE just after it is created document
    You can update to JE to seperate just after JE are created by docuemnts.
    Just Listen FormDataAdd Event.
    Sample Code:
    Private Sub FormDataEventHandler( _
        ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, _
        ByRef BubbleEvent As Boolean) Handles oApp.FormDataEvent
            'I just listen 133 - AR invoice here,
            'You may add the target documents
            'Before action = true, start the transation
            If BusinessObjectInfo.FormTypeEx = "133" _
                    And (BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD _
                    Or BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE) _
                    And BusinessObjectInfo.BeforeAction = True Then
                oCompany.StartTransaction()
            End If
            'Before Action = false,
            'Update the JE in document
            'Succeed, commit, otherwise rollback
            If BusinessObjectInfo.FormTypeEx = "133" _
            And (BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD _
            Or BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE) Then
                If BusinessObjectInfo.BeforeAction = False And BusinessObjectInfo.ActionSuccess Then
                    Dim xmlDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument
                    xmlDoc.LoadXml(BusinessObjectInfo.ObjectKey)
                    Dim objectKey As String
                    objectKey = xmlDoc.SelectSingleNode("//DocEntry").InnerText
                    Dim oDocument As SAPbobsCOM.Documents = Nothing
                    oDocument = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders)
                    If oDocument.GetByKey(CInt(objectKey)) Then
                        Dim oJE As SAPbobsCOM.JournalEntries
                        oJE = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
                        If oJE.GetByKey(oDocument.TransNum) Then
                            '*Add you code to Update oJE lines here*
                            lRetCode = oJE.Update
                            If 0 <> lRetCode Then
                                oApp.MessageBox("Failed to update JE")
                                'roll back the whole transaction, including the document
                                oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
                                Exit Sub
                            Else
                                'Commit the transaction
                                oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
                            End If
                        End If
                    End If
                End If
            End If
        End Sub
    Hope it helps. Thanks.
    Kind Regards
    -Yatsea

  • The report displays more than 3000 pages with same content.

    Respected Sir
    I have a report with form letter layout.
    The report contains only one page,but while running the paper layout ,the report displays more than 3000 pages with same content.
    please anyone give a solution to this problem

    I think there is no bad joining. b'se when the querry is executed in sql, it is working properly(means returns only one record) . This problem is not for a particular report. Any report using the "form layout", the same problem occurs.
    Why this problem occurs. How can we solve it.
    Bye

  • Multiple Infoobject with same technical name

    Hi All,
    I have a very basic question which confuses me a lot.
    I have installed a BI content info cube 0SD_C03(Sales overview) and it is installed in Info Area -  ERP Analytics -->sales and distribution analyses. I checked the dimensions of it and 0customer( master data attr) is linked as a dimension. I created a copy of 0SD_C03 and the new Infocube name is ZSD_C03_T. It also has the same 0customer master data attr as a dimension(obviously!).
    Now both the infocubes have different technical name(0SD_C03 and ZSD_C03_T) since they will be storing different sets of data(lets say). but the technical name of the master data (0CUSTOMER) is the same for both cubes.
    ques 1: Is it since its a master data and contains the same set of master data for both the cubes, it has the same technical name?
    If I search the Info provider section for "0CUSTOMER", i get two entries: One within my info area and another within another info area. And also i can keep doing (Right click Info area--> Insert Characteristic as Infoprovider) on every other info area and insert 0CUSTOMER in every other info area.
    ques 2: does all the 0CUSTOMER in different info areas, actually contain the same set of data?
    ques 3: if i search for 0CUSTOMER in InfoObjects section, i get 5 entries in different infoareas. How can there  be diffferent Infoobject with same technical name be present in different info areas?
    Sorry if i am too elaborate, I hope i have made my questions clear.

    Hi,
    ques 1: Is it since its a master data and contains the same set of master data for both the cubes, it has the same technical name?
    A. same 0CUSTMER you can use the different places it holds same data.
        source is the 0CUST_ATTR -> target is 0CUSTOMER.
    ques 2: does all the 0CUSTOMER in different info areas, actually contain the same set of data?
    A. it will contain the same set of data.
        it has the overwrite function.
    ques 3: if i search for 0CUSTOMER in InfoObjects section, i get 5 entries in different infoareas. How can there  be diffferent Infoobject with same technical name be present in different info areas?
    A. you triggered the 5 times for specif DTP means you will 5 entries for different info areas.
    finally i will say you use the 0CUSTOMER no of places where you required and no need to create the ZCUSTOMER.
    Thanks,
    Phani.

  • Two query with same technical name in Quality

    Hi experts,
    I have two queries in Quality with same technical name. I used the program RENAME_DUPLICATE_ELEMENTS to rename the query and its renaming the latest query instead of the old Query. I am in BI 7.0 system and cant find a note that applies to BI 7.0. There are quite a few notes on 3.x system. Has somebody faced the same problem. What did you do. If there is a note for bi 7.0, please let me know so i can resolve with the Basis team.

    We had similar issues - this happens when you create a query locally and then transport the same.
    The queries have an internal GUID which is generated locally and this causes duplicates.
    You can :
    1. Delete queries using the GUIDS ( you can find this in RZCOMPDIR or RSRREPDIR tables ) using RZDELETE to delete queries.
    identify your older version query and then delete the same and you should be good to go...
    also try identifying the same using program
    ANALYZE_RSZ_TABLES

  • How to get two fields with same tech name in LIS Extractors?

    Hi Experts,
    I need "ERDAT" field from two structures (QMSM & QMFE) in 2LIS_18_IOTASK extractor.
    In LBWE first I moved ERDAT from QMSM. When I moved ERDAT from QMFE it gives an error:
    "Field with same technical name is already available in the Extract Structure".
    I don't want to create Append Structure as we need to write User exit.
    Can any one tell me how to get this field added in the extractor from QMSM and QMFE?
    Thanks for your help.
    Regards,
    Sree

    this is not possible as the all those fields are put in one structure. per definition you can't put the same field name twice in a structure, table in the data dictionary...
    hence, you really need to use an append and fill via user exit
    M.

  • Recreate skype user with same skype name ?

    I just deleted 21 skype users, by mistake, in Business Manager, is it possible to recreate them with same skype name ?
    /Claus

    Hi again,
    Hope this helps.
    alias_maps = hash:/etc/postfix/aliases,hash:/var/mailman/data/aliases
    always_bcc =
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    content_filter = smtp-mailtransport:[127.0.0.1]:10024
    daemon_directory = /usr/libexec/postfix
    debugpeerlevel = 2
    enableserveroptions = yes
    inet_interfaces = all
    luser_relay =
    mail_owner = postfix
    mailbox_transport = cyrus
    mailq_path = /usr/bin/mailq
    manpage_directory = /usr/share/man
    mapsrbldomains =
    messagesizelimit = 10240000
    mydestination = $myhostname,localhost.$mydomain,localhost,apm.pt,onlearn.apm.pt,ml.apm.pt,xserv e.apm.pt
    mydomain = apm.pt
    mydomain_fallback = localhost
    myhostname = mail.apm.pt
    mynetworks = 127.0.0.1/32,195.23.139.104/29
    mynetworks_style = host
    newaliases_path = /usr/bin/newaliases
    ownerrequestspecial = no
    queue_directory = /private/var/spool/postfix
    readme_directory = /usr/share/doc/postfix
    recipient_delimiter = +
    relayhost =
    sample_directory = /usr/share/doc/postfix/examples
    sendmail_path = /usr/sbin/sendmail
    setgid_group = postdrop
    smtpdclientrestrictions = hash:/etc/postfix/smtpdreject
    smtpddelayreject = yes
    smtpdenforcetls = no
    smtpdhelorequired = yes
    smtpdhelorestrictions = permitsasl_authenticated,permitmynetworks, checkheloaccess hash:/etc/postfix/heloaccess,reject_non_fqdn_hostname,reject_invalidhostname,permit
    smtpdpw_server_securityoptions = login
    smtpdrecipientrestrictions = permitsasl_authenticated,permit_mynetworks,reject_unauthdestination,permit
    smtpdsasl_authenable = yes
    smtpdsenderrestrictions = permitsasl_authenticated,permit_mynetworks,reject_non_fqdn_sender,reject_unknown_sende rdomain,permit
    smtpdtlsCAfile =
    smtpdtls_certfile =
    smtpdtls_keyfile = $smtpdtls_certfile
    smtpdtlsloglevel = 0
    smtpduse_pwserver = yes
    smtpdusetls = no
    unknownlocal_recipient_rejectcode = 550
    virtualaliasmaps = hash:/var/mailman/data/virtual-mailman
    João.

  • Insert row with same formatted cells

    I am a newbye with Numbers.
    I have created a spreadsheet with some columns and every cell formatted, such as a list or a box to check.
    Until now every time I have inserted a new row the system create a row with the same formattated cells,
    now the system insert a blank row without formattated cells.
    Please, help me! Thanks.

    Vin,
    Being new to Numbers, you should read the Numbers User Guide, available as a free download from the help menu.
    The problem you are experiencing may be in another column. The condition that Barry mentioned, having the same expression or special format in every body row, applies to every column in the table.
    Jerry

  • Grouping consecutive rows with same value?

    Hi
    I have a table in which three columns are:
    ROWID  SHOPNAME
    1      SHOP_C     
    2      SHOP_A     
    3      SHOP_C     
    4      SHOP_C     
    5      SHOP_A     
    6      SHOP_A     
    7      SHOP_C     
    8      SHOP_B     
    9      SHOP_B     
    10     SHOP_E    
    11     SHOP_A     
    12     SHOP_D     
    13     SHOP_D     
    14     SHOP_F     
    15     SHOP_G     
    16     SHOP_F     
    17     SHOP_C     
    18     SHOP_C     
    19     SHOP_C     
    20     SHOP_C      Rowid is a primary key column with unique ids
    Shopname is varchar2 column
    I want to make groupings of every "shopname" value "order by ROWID" such that when there are consecutive rows of same shopname the group remains same and as soon as there is different value in shopname column for the next row the "group" changes.
    below is my desired output is with 3rd column of groupings as follows:
    ROWID  SHOPNAME    Groups
    1      SHOP_C      1
    2      SHOP_A      2
    3      SHOP_C      3 ------> same grouping because Shop name is same
    4      SHOP_C      3 ------> same grouping because shop name is same
    5      SHOP_A      4 ----> different shopname so group changed.
    6      SHOP_A      4 ----> same group as above because shopname is same
    7      SHOP_C      5
    8      SHOP_B      6
    9      SHOP_B      6
    10     SHOP_E      7
    11     SHOP_A      8
    12     SHOP_D      9
    13     SHOP_D      9
    14     SHOP_F      10
    15     SHOP_G      11
    16     SHOP_F      12
    17     SHOP_C      13
    18     SHOP_C      13
    19     SHOP_C      13
    20     SHOP_C      13I want that to be done via analytics, so that I can partition by clause for different shops over different cities
    regards
    Ramis.

    with data(row_id, shop) as
    select 1,      'SHOP_C' from dual union all
    select 2,      'SHOP_A' from dual union all     
    select 3,      'SHOP_C' from dual union all
    select 4,      'SHOP_C' from dual union all    
    select 5,      'SHOP_A' from dual union all     
    select 6,      'SHOP_A' from dual union all
    select 7,      'SHOP_C' from dual union all
    select 8,      'SHOP_B' from dual union all
    select 9,      'SHOP_B' from dual union all
    select 10,     'SHOP_E' from dual union all
    select 11,     'SHOP_A' from dual union all
    select 12,     'SHOP_D' from dual union all
    select 13,     'SHOP_D' from dual union all
    select 14,     'SHOP_F' from dual union all
    select 15,     'SHOP_G' from dual union all
    select 16,     'SHOP_F' from dual union all
    select 17,     'SHOP_C' from dual union all
    select 18,     'SHOP_C' from dual union all
    select 19,     'SHOP_C' from dual union all
    select 20,     'SHOP_C' from dual
    get_data as
      select row_id, shop,
             lag(shop) over (order by row_id) prev_shop
        from data
    select row_id, shop,
           sum(case when shop = prev_shop
                      then  0
                      else 1
                      end
                ) over (order by row_id) grps
      from get_data;
    ROW_ID SHOP   GRPS
         1 SHOP_C    1
         2 SHOP_A    2
         3 SHOP_C    3
         4 SHOP_C    3
         5 SHOP_A    4
         6 SHOP_A    4
         7 SHOP_C    5
         8 SHOP_B    6
         9 SHOP_B    6
        10 SHOP_E    7
        11 SHOP_A    8
        12 SHOP_D    9
        13 SHOP_D    9
        14 SHOP_F   10
        15 SHOP_G   11
        16 SHOP_F   12
        17 SHOP_C   13
        18 SHOP_C   13
        19 SHOP_C   13
        20 SHOP_C   13
    20 rows selected

  • Get Min value and another column value from the same row

    hi all - for each customer and product, I need to grab the row that has the min value for field Value1. I could've just done group by on customer and product and min on Value1, but I also need to grab Vlaue2 from the same row where the minimum value for
    Value1 lies.
    DECLARE @Temp TABLE (CustomerID INT, ProductID VARCHAR(10), Trans_Date Date, Value1 INT, Value2 INT)
    INSERT INTO @Temp VALUES (123, 'ABC', '1/1/2013', 10, 100)
    INSERT INTO @Temp VALUES (456, 'ASD', '1/1/2013', 40, 500)
    INSERT INTO @Temp VALUES (456, 'ASD', '2/1/2013', 90, 700)
    INSERT INTO @Temp VALUES (123, 'ABC', '2/1/2013', 20, 700)
    SELECT * FROM @Temp
    The output should be
    123, ABC, 10, 100
    456, ASD, 40, 500
    I know that I can just join the table to itself and get the desired output but I am dealing with a table that has millions of rows and I was hoping there is more efficient way to do this. any help would be highly appreciated...

    Here is a correction on your DDL to make it into nearly valid table.
    CREATE TABLE Sales
    (customer_id INTEGER NOT NULL,
    product_id CHAR(10) NOT NULL,
    transaction_date DATE NOT NULL,
    PRIMARY KEY (customer_id, product_id, transaction_date),
    value1 INTEGER NOT NULL,
    value2 INTEGER NOT NULL);
    Here is the current syntax for insertion:
    INSERT INTO Sales
    VALUES (123, 'abc', '2013-01-01', 10, 100),
    (456, 'asd', '2013-01-01', 40, 500),
    (456, 'asd', '2013-02-01', 90, 700),
    (123, 'abc', '2013-02-01', 20, 700);
    WITH
    X
    AS
    (SELECT customer_id, product_id, transaction_date, value1, value2,
    MIN(value1) OVER () AS value1_min
    FROM Sales)
    SELECT X.*
    FROM X
    WHERE X.value1_min = X.value1;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Does pivotTable support rows with duplicated row names?

    I am developing an application using JDeveloper 11.1.1.6.0.
    Pivot table can display attribute values as row or column names. If the "row name" attribute for two records has the same/duplicated values, does pivot table show the two records in two rows with the same row name?
    My experiment shows only one row with blank value for "measure" in such case. Just want to confirm this is the expected behavior.

    Hi,
    don't quite understand the use case so answering in general: no data should be lost when using Pivot table
    Frank

  • Can't compare a row with other rows within a table.. (many to many compare)

    Hi all..
    I am very new to PL/SQL..
    I need to travers through a table for comparing it's rows with in the table with other rows. For this I am trying to use bellow Pl/sql.
    create or replace compare()
    Declare
    VAR_HIT CHAR(1);
    SEARCH_RECORD_DATA UDB.table1%ROWTYPE;
    CANDIDATE_RECORD_DATA UDB.table1%ROWTYPE;
    CURSOR SEARCH_RECORDS_CURSOR IS SELECT * FROM UDB.table1 order by registration_id;
    CURSOR CANDIDATE_RECORDS_CURSOR IS SELECT * FROM UDB.table1 order by registration_id;
    BEGIN
    FOR SEARCH_RECORD_DATA IN SEARCH_RECORDS_CURSOR LOOP
    FOR CANDIDATE_RECORD_DATA IN CANDIDATE_RECORDS_CURSOR LOOP
    IF (CANDIDATE_RECORD_DATA.DECISION='P') THEN
    VAR_HIT:='y';
    IF(CANDIDATE_RECORD_DATA.FIRST_NAME!='unknown') AND (CANDIDATE_RECORD_DATA.FIRST_NAME!=SEARCH_RECORD_DATA.FIRST_NAME) THEN
    VAR_HIT:='n';
    ELSIF(CANDIDATE_RECORD_DATA.LAST_NAME!='unknown') AND (CANDIDATE_RECORD_DATA.LAST_NAME!=SEARCH_RECORD_DATA.LAST_NAME) THEN
    VAR_HIT:='n';
    ELSIF(CANDIDATE_RECORD_DATA.BIRTH_DATE!='unknown') AND (CANDIDATE_RECORD_DATA.BIRTH_DATE!=SEARCH_RECORD_DATA.BIRTH_DATE) THEN
    VAR_HIT:='n';
    ELSIF(CANDIDATE_RECORD_DATA.GENDER!='U') AND (CANDIDATE_RECORD_DATA.GENDER!=SEARCH_RECORD_DATA.GENDER) THEN
    VAR_HIT:='n';
    ELSIF(CANDIDATE_RECORD_DATA.FATHER_NAME!='unknown') AND (CANDIDATE_RECORD_DATA.FATHER_NAME!=SEARCH_RECORD_DATA.FATHER_NAME) THEN
    VAR_HIT:='n';
    ELSIF (CANDIDATE_RECORD_DATA.MOTHER_NAME!='unknown') AND (CANDIDATE_RECORD_DATA.MOTHER_NAME!=SEARCH_RECORD_DATA.MOTHER_NAME) THEN
    VAR_HIT:='n';
    END IF;
    IF(VAR_HIT='y') THEN
    INSERT INTO UDB.BIO_DI_HIT_RESULT(REGISTRATION_ID,SEARCH_ID,HIT_CANDIDATE_ID,SEARCH_DETAILS,CANDIDATE_DETAILS) VALUES (SEARCH_RECORD_DATA.REGISTRATION_ID,SEARCH_RECORD_DATA.EGM_NO,CANDIDATE_RECORD_DATA.EGM_NO,VAR_SEARCH_DETAILS,VAR_CANDIDATE_DETAILS);
    UPDATE UDB.BIO_RECORDS_DEMOGRAPHICS SET DECISION='D';
    END IF;
    END IF;
    END LOOP;
    commit;
    END LOOP;
    END;
    Outer loop is working fine (it is raversing throughout the table) (say for 8000 records 8000 times)
    But Enner loop is not working fine e.i. it's running just for 8000 times for 8000 records. while it should run more then 8000 time..
    Can any one help me..
    Is the way of using two cursor on one table for comparing each row of record is correct????????? :(

    Finally I come up with this:
    INSERT INTO UDB.BIO_DI_HIT_RESULT(REGISTRATION_ID,SEARCH_ID,HIT_CANDIDATE_ID,SEARCH_DETAILS,CANDIDATE_DETAILS)
    SELECT SEARCH.REGISTRATION_ID, SEARCH.Key_NO,CANDIDATE.Key_NO,
    'First name='||SEARCH.FIRST_NAME||',Last name='||SEARCH.LAST_NAME||',Birth date='||SEARCH.BIRTH_DATE||',Gender='||SEARCH.GENDER||',Fathers name='||SEARCH.FATHER_NAME||',Mother name='||SEARCH.MOTHER_NAME,
    'First name='||CANDIDATE.FIRST_NAME||',Last name='||CANDIDATE.LAST_NAME||',Birth date='||CANDIDATE.BIRTH_DATE||',Gender='||CANDIDATE.GENDER||',Fathers name='||CANDIDATE.FATHER_NAME||',Mother name='||CANDIDATE.MOTHER_NAME
    FROM UDB.BIO_RECORDS_DEMOGRAPHICS SEARCH,UDB.BIO_RECORDS_DEMOGRAPHICS CANDIDATE
    WHERE (SEARCH.FIRST_NAME!='unknown' OR SEARCH.LAST_NAME!='unknown' OR SEARCH.BIRTH_DATE!='unknown' OR SEARCH.GENDER!='unknown' OR SEARCH.FATHER_NAME!='unknown' OR SEARCH.MOTHER_NAME!='unknown')
    AND SEARCH.REGISTRATION_ID != CANDIDATE.REGISTRATION_ID
    AND SEARCH.REGISTRATION_ID < CANDIDATE.REGISTRATION_ID
    AND (SEARCH.FIRST_NAME='unknown' OR CANDIDATE.FIRST_NAME IN (SEARCH.FIRST_NAME,'unknown'))
    AND (SEARCH.LAST_NAME='unknown' OR CANDIDATE.LAST_NAME IN (SEARCH.LAST_NAME,'unknown'))
    AND (SEARCH.BIRTH_DATE='unknown' OR CANDIDATE.BIRTH_DATE IN (SEARCH.BIRTH_DATE,'unknown'))
    AND (SEARCH.GENDER='U' OR CANDIDATE.GENDER IN (SEARCH.GENDER,'U'))
    AND (SEARCH.BIRTH_DATE='unknown' OR CANDIDATE.BIRTH_DATE IN (SEARCH.BIRTH_DATE,'unknown'))
    AND (SEARCH.FATHER_NAME='unknown'OR CANDIDATE.FATHER_NAME IN (SEARCH.FATHER_NAME,'unknown'))
    AND (SEARCH.MOTHER_NAME='unknown' OR CANDIDATE.MOTHER_NAME IN (CANDIDATE.MOTHER_NAME,'unknown'))
    ORDER BY SEARCH.REGISTRATION_ID;
    Now it realy meet all my final table requirement.. I am happy.. :)
    But again last requirement is like..
    In the final BIO_DI_HIT_RESULT table I need to add one more column named as match_count
    This column will have values of total no. of exact match field (not unknown) for each records in the BIO_DI_HIT_RESULT.....
    One way of duing this is--
    Step1: I will use a cursor for traversing through each of the rows in BIO_DI_HIT_RESULT.
    Step 2: And based on count of matches in search_details(substring) and candiate_details(substring) I update each and every rows of the table.
    It will be very slow.. And for records like 2 million records.. I can't think of this idea. :(
    Sooooo,, Is there ANY BETTER WAY OF DOING THIS AS WELL.. BETTER MEANS FAST WAY.. :(
    Thanks in advance....
    Edited by: user13367608 on Jan 8, 2011 2:13 AM

  • Interchange values from one row with another row

    Dear Oracle Guru's
    While Migrating data from legacy system, there was a confusion and data in two columns got jumbled
    Ex The data should be like this
    Custcode leaseno
    1034 A234
    1035 A235
    1036 A236
    whereas the table has data like this
    Custcode leaseno
    1034 A235
    1035 A234
    1036 A237
    1037 A236
    How do we swap values between two rows
    Kindly guide me on this
    With Warm Regards
    ssr

    >
    Ex The data should be like this
    Custcode leaseno
    1034 A234
    1035 A235
    1036 A236
    whereas the table has data like this
    Custcode leaseno
    1034 A235
    1035 A234
    1036 A237
    1037 A236
    How do we swap values between two rows And now, time for yet another guess... ;)
    My guess is that your migration program interchanged "leaseno" value in pairs from the top - the top being the least value of "custcode".
    So, the "leaseno" values of Row 1 and Row 2 were swapped.
    The "leaseno" values of Row 3 and Row 4 were swapped.
    And so on.
    Which also means that if the total number of rows in your table is even, then the swap would be "complete". Otherwise, the last row would be left out. I don't know what you want to do with that.
    test@XE>
    test@XE> select * from t;
      CUSTCODE LEAS
          1034 A235
          1035 A234  <= you want to swap A235 and A234
          1036 A237
          1037 A236  <= you want to swap A237 and A236
          1038 A238  <= let's leave it hanging there...
    5 rows selected.
    test@XE>
    test@XE> And of course, swapping from "top to bottom" means swapping from the least to highest value of "custcode".
    Here's the SELECT statement for that -
    test@XE>
    test@XE> -- show the records in the table t
    test@XE>
    test@XE> select * from t;
      CUSTCODE LEASENO
          1034 A235
          1035 A234
          1036 A237
          1037 A236
          1038 A238
    5 rows selected.
    test@XE>
    test@XE> -- the SELECT statement for swapping leaseno values
    test@XE>
    test@XE> @test7a
    test@XE> --
    test@XE> select custcode,
      2         leaseno,
      3         case
      4           when mod(row_number() over (order by custcode),2) = 1 and
      5                lead(leaseno) over (order by custcode) is null
      6           then leaseno
      7           when mod(row_number() over (order by custcode),2) = 1
      8           then lead(leaseno) over (order by custcode)
      9           else lag(leaseno) over (order by custcode)
    10         end as new_leaseno
    11  from t;
      CUSTCODE LEASENO NEW_LEASENO
          1034 A235    A234
          1035 A234    A235
          1036 A237    A236
          1037 A236    A237
          1038 A238    A238
    5 rows selected.
    test@XE>
    test@XE> And here's the update statement -
    test@XE>
    test@XE> -- the UPDATE statement for updating leaseno values in pairs from the top
    test@XE>
    test@XE> @test7b
    test@XE> --
    test@XE> update t t1
      2  set t1.leaseno = (
      3    select new_leaseno
      4    from (
      5      select custcode,
      6             leaseno,
      7             case
      8             when mod(row_number() over (order by custcode),2) = 1 and
      9                  lead(leaseno) over (order by custcode) is null
    10             then leaseno
    11             when mod(row_number() over (order by custcode),2) = 1
    12             then lead(leaseno) over (order by custcode)
    13             else lag(leaseno) over (order by custcode)
    14           end as new_leaseno
    15      from t
    16    ) t2
    17    where t2.custcode = t1.custcode
    18  );
    5 rows updated.
    test@XE>
    test@XE>
    test@XE> select * from t;
      CUSTCODE LEASENO
          1034 A234
          1035 A235
          1036 A236
          1037 A237
          1038 A238
    5 rows selected.
    test@XE>
    test@XE> HTH,
    isotope

  • Setting the Previous row with New row value

    Dear All,
    I have a af:showDetailItem in which i have a af:table where i can add the Warranty details of Products in which i have:
    eg:
    Product | WEF | ValidUntil
    ================================================
    Prod1 | 01-05-11 | 01-06-11
    Prod2 | 02-06-11 |
    Here i want to enter the "Valid Until" only when i create an entry for new Warrenty details and enter the WEF.ie Valid Until will be WEF-1 of the next row.
    so any idea of how to solve this problem.?
    Regards,
    Soya.

    Hi,
    Aren't effective-dated entities used to create a new column based on some existing column in the same row.
    But my need is to set the value of the previous row when the new row is inserted.
    Product | WEF | ValidUntil
    ================================================
    Prod1 | 01-05-11 | *01-06-11*
    Prod2 | *02-06-11* |
    rgds
    Soya

  • Table row with multiple row

    Hi All,
    I am using NWDS 2004
    I want to have a table with multiple rows in a row.
    Can any one help ?
    Thanks

    hi Akhilesh,
    Use tree table for your requirement.
    [Tree Table Tutorial|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/de59f7c2-0401-0010-f08d-8659cef543ce]
    Hope this helps!
    Monalisa

Maybe you are looking for

  • Flash Lite in Flash CS3

    Hi all, I've just earned a freelance contract to develop a mobile phone game, & i've got a copy of CS3 Design Premium on the way, which includes Flash CS3 Professional. I've developed Flash games before using the Flash Lite 2.1 plugin for Flash 8 Pro

  • Thunderbird Jams Everytime I Open An E-mail. CAUSE: McAfee?

    Hello, I've recently switched computers and moved my e-mail accounts over my copying the "profiles" over (it was a mac > windows so was the only way). Even before installing those profiles thunderbird has been pretty slow and jams frequently, but wit

  • Wish I could create album by month of the year

    Hi all - I'm creating a photo calendar again for my family. In each month, I want to have pictures from that month. There are years of work in my 7200 photos. Is there any way to create a smart album that only has pictures taken in March, for example

  • Passwords included in iCloud backup?

    This is something I couldn't find an answer for yet. I encrypt the iTunes backup of my iPhone and iPad to make sure that I don't have to enter all the passwords after restoring a device. Yes, I'm lazy. When I switch to iCloud backups, will this chang

  • Bridge won't work with desktop thumbnails

    I have a mac and when I try to use bridge with my desktop it has been disappearing.