Finding duplicate ranges for rows in a table

Data in the table
ROW NUM ID A_FROM A_TO B_FROM B_TO
1 1 1 10 1 10
2 1 1 20 2 20
3 1 3 30 2 20
4 2 10 20 10 20
5 2 10 30 20 30
6 3 10 20 10 20
I want to identify rows based on "ID" columns which has overlaping range of data for column A and column B.
example
In above data based on ID 1 the row # 2 should be flagged due to the fact that col A_FROM and A_TO in row1 overlaps with row #1.
Also, row #3 should be flagged due to the fact that col B_FROM and B_TO in row2 overlapps with row #2.
Any help is appreciated.

TABLE - "rate_table"
ID     A_FROM     A_TO     B_FROM     B_TO     RATE
1     10     20     100     200     0.5
1     10     30     201     300     0.25
1     31     40     200     300     0.25
2     10     20     1000     2000     0.275
2     21     30     1000     2000     0.385
3     10     20     1000     2000     0.658
3     10     30     2000     5000     0.541
3     31     40     1000     2000     0.695
Above table is being used to update another table based on ID column
Update Statement
Update table1 t
set t.rate = (select r.rate from rate_table r
where t.id = r.id and
(t.col_a between r.a_from and r.a_to) and
(t.col_b between r.b_from and r.b_to) )
where exists
(select 0 from rate_table r
where t.id = r.id and
(t.col_a between r.a_from and r.a_to) and
(t.col_b between r.b_from and r.b_to) )
This update would return error
"ORA-01427: single-row subquery returns more than one row"
This is due to the fact that while matching records against table TABLE1 to RATE_TABLE, the range for specific ID are overlapping.
My question.
How can I identity or avoid ORA-01427 error on the update statement? or how do i identity overlapping range records in RATE_TABLE?

Similar Messages

  • ORA-13223: duplicate entry for string in SDO_GEOM_METADATA table and

    I got the above error while trying to insert a record into the table SDO_GEOM_METADATA. However, when querying this table I did find any duplicate table_name, column_name pair that match with the error.
    Here are the steps that I worked on:
    1. Add a geometry column into an existing table.
    ALTER TABLE GEO_MAP ADD (ORG_GEOM mdsys.sdo_geometry);
    2. Register the new column into mdsys
    insert into USER_SDO_GEOM_METADATA
    values ('GEO_MAP','ORG_GEOM',
    mdsys.sdo_dim_array(
    mdsys.sdo_dim_element('LONG',-180,180,0.00005),
    mdsys.sdo_dim_element('LAT',-90,90,0.00005)
    8307)
    I got the error ORA-13223: duplicate entry for string in SDO_GEOM_METADATA table even there was no such record in there.
    3. I inserted values in the column ORG_GEOM fine.
    4. However, when I tried to create the index for this column I got the error:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA view
    ORA-13203: failed to read
    Please help.
    Thanks.

    SQL> select * from mdsys.sdo_geom_metadata_table;
    SDO_OWNER SDO_TABLE_NAME
    SDO_COLUMN_NAME
    SDO_DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)
    SDO_SRID
    QW_USER1 GEO_REF
    LOC_GEOM
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('LONG', -180, 180, .00005), SDO_DIM_ELEMENT('LAT',
    -90, 90, .00005))
    SDO_OWNER SDO_TABLE_NAME
    SDO_COLUMN_NAME
    SDO_DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)
    SDO_SRID
    8307
    MDSYS SDO_CMT_CBK_RTREE_TAB
    GEOM
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', -180, 180, .000000005), SDO_DIM_ELEMENT('Y',
    SDO_OWNER SDO_TABLE_NAME
    SDO_COLUMN_NAME
    SDO_DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)
    SDO_SRID
    -90, 90, .000000005))
    The situation is we have 2 tables (GEO_MAP, and GEO_REF) that have spatial columns. Everything worked fine until when one of the queries that searched through the table GEO_MAP ran so slow, we decided to rebuild the related spatial index by dropping and recreating it. However, after I dropped it I could not recreated. Keep getting the error:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA view
    ORA-13203: failed to read
    Any help is very much appreciated.

  • How to find the Ranges for a field ?

    Hello All,
               Can anyone tell me how to find the ranges for a field.
    <b>1</b>, i.e say I want the Ranges Structure for the field LIFNR.
        The ranges structure for this is "<b>RANGE_LIFNR</b>".
        This I used in my Program since I know it previously.
        But now I want the ranges structure for the field <b>VBELN (Delivery Document).</b>
        I  don't know what is it !!!!!
    <b>2</b>, Is there any procedure to know the ranges structure for a particular field ?
    Regards,
    Deepu.K

    Hi Deepu,
    Using 'Where used list' you can able to find out RANGES tables.
    For VEBLN range table is --> CRM_AC_ASSIGN_VBELN
    If you using a program defined as shown below.
    DATA: r_vbeln type ranges of vbeln.
    The above statement also creates ranges structure in Runtime.
    Procedure finding range table structures
    go to SE37 -> Enter domain or dataelement value
    Go to where used list --> search for 'Structures'
    After getting all structure  --> Click 'SEARCH' butoon in tool bar --> Search for 'RANGES' word
    You can get all ranges tables in the search window
    If helps plz reward points.
    Regards
    Bhupal Reddy

  • How can I display "detailStamp" facet selectively for rows in a table ?

    Hi,
    My JDEV version is Studio Edition Version 11.1.1.5.0
    I am trying to display "detailStamp" facet selectively .
    If I read api in link below
    http://docs.oracle.com/cd/E26098_01/apirefs.1112/e17488/oracle/adf/view/rich/component/rich/data/RichTable.html
    Use the "detailStamp" facet on the Table to include a collapsable content area for each table row. Please note that the height of the open detail area will be a set height based on the height of the detailStamp component. Adding a component that changes in height (like showDetail or panelBox) will by default produce strange results when the detailStamp component's height changes.
    Detail Stamp can be selectively displayed for rows in the table by EL binding the "rendered" attribute of the "detailStamp" facet to "true" or "false". The EL binding can contain references to the table "var" attribute since during rendering it will be executed in the context of the row. Disclosure icon is displayed only for rows which have rendered="true".
    I can see that i can achieve it by setting rendered property for that facet. BUT this property is not available in Studio Edition Version 11.1.1.5.0

    Hi Frank.
    Thanks for your quick reply .
    But I am using Studio Edition Version 11.1.1.5.0 . In this version the property RENDERED of f:facet name="detailStamp" is NOT allowed.
    Edited by: user13764942 on Feb 7, 2013 5:48 AM
    Put in another way , I want to render the "detailStamp" facet selectively for rows , so for that I need the RENDERED property of "detailStamp" facet. This property is ONLY available in Jdev version 11.2 . I am using Jdev 11.1.1.5.0 so I need some alternative to RENDERED property as this property is NOT available in Jdev 11.1.1.5.0.
    Please suggest some way to achieve this behaviour of displaying "detailStamp" facet selectively ....
    Thanks!
    Edited by: Mangpal Singh on Feb 7, 2013 11:57 PM

  • Find date range for sick leaves

    Hi,
    Ive been trying to get readable output from HR system.
    I have added the source data into Data Model, since i had to read the data with power query. Now i have pivot table like this:
    date        workdaY?    user
    6.3.2014    Sickleave    user1
    1.2.2014    Sickleave    user2
    2.2.2014    Sickleave    user2
    5.3.2014    Sickleave    user4
    5.3.2014    Sickleave    user1
    5.5.2014    Sickleave    user1
    16.9.2014  Sickleave    user3
    7.3.2014    Sickleave    user1
    6.5.2014    Sickleave    user1
    6.3.2014    Sickleave    user4
    Is there any possible way to get some kind of find function to sort and combine the data like this:
    user1        Sickleave    5.3-7.3.2014
    user1        Sickleave    5.5-6.5.2014
    user2        Sickleave    1.2-2.2.2014
    user3        Sickleave    16.9-16.9.2014
    user4        Sickleave    5.3-6.3.2014

    One way to do this is with a VBA macro.  The following should get you started.
    As you can see looking at the macro, the original data is assumed to be on a worksheet named HRData and starts in A1.
    The results are placed on the same worksheet but starting at cell G1.  You could easily write the results to another worksheet.
    The original data is copied to a temporary worksheet for sorting (and the temporary sheet is subsequently deleted).
    A Class Module is added so we can use a User Defined Object which has the properties of the user name, start date and end date of the vacation period.
    We then cycle through the sorted data, and create a Sickleave object and add it to a collection.  If the "previous" row has the same user, and the date is one more than the previous End Date, we add one to the previous end date; if not, we
    create a new object and start another sickleave period.
    This is the data input:
    and  here are the results:
    To enter this Macro (Sub), <alt-F11> opens the Visual Basic Editor.
    Ensure your project is highlighted in the Project Explorer window.
    First, from the top menu, select Insert/Class Module.  Highlight the new class module in the Project Explorer; click F4, and rename it to cSickLeave
    Then paste the code below into that class module:
    =======================================
    Option Explicit
    Private pUser As String
    Private pStartDt As Date
    Private pEndDt As Date
    Public Property Get User() As String
    User = pUser
    End Property
    Public Property Let User(Value As String)
    pUser = Value
    End Property
    Public Property Get StartDt() As Date
    StartDt = pStartDt
    End Property
    Public Property Let StartDt(Value As Date)
    pStartDt = Value
    End Property
    Public Property Get EndDt() As Date
    EndDt = pEndDt
    End Property
    Public Property Let EndDt(Value As Date)
    pEndDt = Value
    End Property
    Then, from the top menu, select Insert/Module and
    paste the code below into the regular module window that opens.
    To use this Macro (Sub), <alt-F8> opens the macro dialog box. Select the macro by name, and <RUN>.
    ====================================
    Option Explicit
    Option Compare Text
    Sub SickLeave()
    Dim cSL As cSickLeave, colSL As Collection
    Dim wsSrc As Worksheet, wsRes As Worksheet
    Dim wsTemp As Worksheet, rTemp As Range
    Dim vSrc As Variant, rSrc As Range
    Dim vRes() As Variant, rRes As Range
    Dim I As Long
    'set Worksheets
    Set wsSrc = Worksheets("HRData")
    With wsSrc
    Set rSrc = .Range("A1", .Cells(.Rows.Count, "C").End(xlUp))
    End With
    Set wsRes = Worksheets("HRData")
    Set rRes = wsRes.Range("G1") 'upper left cell of results
    'Sort the HRdata on a Temp sheet
    Worksheets.Add
    Set wsTemp = ActiveSheet
    Set rTemp = wsTemp.Range("A1")
    rSrc.Copy rTemp
    Set rTemp = rTemp.CurrentRegion
    With rTemp
    .Sort key1:=.Columns(3), order1:=xlAscending, _
    key2:=.Columns(1), order2:=xlAscending, _
    Header:=xlYes, MatchCase:=False
    End With
    vSrc = rTemp.Value
    With Application
    .ScreenUpdating = False
    .DisplayAlerts = False
    wsTemp.Delete
    .DisplayAlerts = True
    End With
    'create collection for results
    Set colSL = New Collection
    For I = 2 To UBound(vSrc)
    If vSrc(I, 2) = "Sickleave" Then
    If I = 2 Then
    Set cSL = New cSickLeave
    With cSL
    .User = vSrc(I, 3)
    .StartDt = vSrc(I, 1)
    .EndDt = vSrc(I, 1)
    colSL.Add cSL
    End With
    ElseIf vSrc(I, 3) = colSL(colSL.Count).User And _
    (vSrc(I, 1) - 1) = colSL(colSL.Count).EndDt Then
    With colSL(colSL.Count)
    .EndDt = .EndDt + 1
    End With
    Else
    Set cSL = New cSickLeave
    With cSL
    .User = vSrc(I, 3)
    .StartDt = vSrc(I, 1)
    .EndDt = vSrc(I, 1)
    colSL.Add cSL
    End With
    End If
    End If
    Next I
    ReDim vRes(0 To colSL.Count, 1 To 3)
    vRes(0, 1) = "User"
    vRes(0, 2) = "workdaY?"
    vRes(0, 3) = "Date Range"
    For I = 1 To colSL.Count
    With colSL(I)
    vRes(I, 1) = .User
    vRes(I, 2) = "Sickleave"
    vRes(I, 3) = Format(.StartDt, "d.m\-") & _
    Format(.EndDt, "d.m.yyyy")
    End With
    Next I
    Set rRes = rRes.Resize(UBound(vRes) + 1, UBound(vRes, 2))
    With rRes
    .EntireColumn.Clear
    .Value = vRes
    .EntireColumn.AutoFit
    .Rows(1).HorizontalAlignment = xlCenter
    End With
    Application.ScreenUpdating = True
    End Sub
    Ron

  • Delete a range of rows in Oracle Table

    How do i delete a range of values in Oracle Table using SQL Pus. For example i have iwanted to delete rows with user_id from 12344 ~ 12399

    ustin thanks for the earlier help. Part of the requiremnt is met, now the tester can delete the rage of rows from 'dropbox', table. I am quiet not done in my second of the requirement. And that is pull the first 100 or 200 etc rows from the parent table (user_auth), and delete them from (dropbox). user_auth does not get affected. I able to user rank and dense_rank by create_time against user_auth table, and get the first 100 or 200 rows. However when join with dropbox, for example dropbox.user_id=user_auth.user_id. Query get hunged. I am not sure do i need to write a procedure for this, or a can be acieved by SQL. This is a test env.
    SQL> desc user_auth
    Name Null? Type
    USER_ID NOT NULL NUMBER(10)
    USER_NAME NOT NULL VARCHAR2(32)
    ACCOUNT_STATUS_CODE NOT NULL NUMBER(3)
    PASSWD VARCHAR2(13)
    DEVICE_ID_TYPE VARCHAR2(10)
    DEVICE_ID VARCHAR2(36)
    OLD_MSISDN NUMBER(15)
    MASTER_LOCK_CODE VARCHAR2(3)
    PARTNER_ID NOT NULL NUMBER(3)
    CREATE_TIME NUMBER(10)
    MAIL_PROVISIONED NOT NULL NUMBER(1)
    PASSWD_TYPE_ID NUMBER(3)
    USER_ID is primary key.
    INDEX_NAME INDEX_TYPE UNIQUENES
    PK_USER_AUTH_USER_ID NORMAL UNIQUE
    I_USER_AUTH_USER_NAME_PARTNER NORMAL UNIQUE
    I_USER_AUTH_DEVICE NORMAL UNIQUE
    I_USER_AUTH_MSISDN NORMAL UNIQUE
    DROPBOX
    Name Null? Type
    USER_ID NOT NULL NUMBER(10)
    DROPBOX_ID NUMBER(10)
    UPDATE_TIME NUMBER(10)
    MESSAGE_TYPE VARCHAR2(64)
    MESSAGE BLOB
    SURVIVE_REBOOT NUMBER(1)
    DELETE_TIME NOT NULL NUMBER(10)
    No Primary KEY
    INDEX_NAME INDEX_TYPE UNIQUENES
    I_DROPBOX_USER_ID NORMAL NONUNIQUE
    I_DROPBOX_SURVIVE_REBOOT NORMAL NONUNIQUE
    If I run
    select user_id, create_time, rnk1 FROM
    (select user_id, user_name, to_char(convert_unix_time(create_time)) create_time, DENSE_RANK() OVER (ORDER BY user_name) rnk1 from user_auth where user_name LIKE '%stomp%_%')
    where rnk1 < 100
    I get the result. How do i select these first 100 rows in the dropbox and delete them. relationship is many to many.

  • FInding differences is successive rows in a table

    Hi ,
    I have a few Audit tables which store all the changes in Entities in my application.. so I have tables like
    aud_table1, aud_table2 ...etc ... which have variable structure depending on actual entity audited.
    Above table store the complete entity snapshot from original table as soon as they are updated. Now I need to create a difference view where I will compare adjacent rows to find out the difference and display to user. Is it possible to find these differences directly using Sql query may be using Pivot(Crosstabulation)

    Hi,
    It would by much more efficient to just make one pass through the table, like this:
    WITH  cntr     AS
         SELECT     CASE     LEVEL
                   WHEN  1  THEN  'Name'
                   WHEN  2  THEN  'Quantity'
                   WHEN  3      THEN  'Alias'
              END     AS fieldname
         FROM     dual
         CONNECT BY     LEVEL <= 3
    ,     unpivoted_data     AS
         SELECT     a.entityid
         ,     c.fieldname
         ,     CASE     c.fieldname
                   WHEN  'Name'      THEN  a.name
                   WHEN  'Quantity'  THEN  TO_CHAR (a.quantity)
                   WHEN  'Alias'       THEN  a.alias
              END     AS newvalue
         ,      a.updatedby
         ,     a.updatedon
         FROM          auit_table     a
         CROSS JOIN     cntr          c
    ,     got_oldvalue     AS
         SELECT     u.*
         ,     LAG (newvalue, 1, newvalue) OVER ( PARTITION BY  entity_id
                                                      ,                fieldname
                                     ORDER BY      updatedon
                                   ) AS oldvalue
         FROM     unpivoted_data     u
    SELECT    entitiyid
    ,       fieldname
    ,       oldvalue
    ,       newvalue
    ,       updatedby
    ,       updatedon
    FROM       got_oldvalue
    WHERE       LNNVL (oldvalue = newvalue)
    ORDER BY  entityid
    ,            updatedon
    ,       fieldname
    ;If you would post CREATE TABLE and INSERT statements for your sample data, then I could test this.
    Edited by: Frank Kulash on May 18, 2010 11:59 PM
    Tested

  • PT 8.51 Upgrade - How to find duplicate keys for Portal Registry Structure?

    I am upgrading peopletools for two applications (CRM 9.00 and FDM 9.00) from the 8.48.10 to 8.51.11 versions.
    For CRM, Task 4-15-9 Completing the Peopletools Conversion ran app engine PTUPGCONVERT ran smoothly.
    For FDM, I have the following error messages:
    The Navigation Pagelet does not exist. Portal = EMPLOYEE. Object = PT_SC_PGT_MAIN_MENU. Collection = PT_PTPP_PORTAL_ROOT (219,2083)
    Message Set Number: 219
    Message Number: 2083
    Message Reason: The Navigation Pagelet does not exist. Portal = EMPLOYEE. Object = PT_SC_PGT_MAIN_MENU. Collection = PT_PTPP_PORTAL_ROOT (219,2083)
    Duplicate key. Portal: EMPLOYEE, Obj Name: PT_SC_PGT_MAIN_MENU, Nodename: LOCAL_NODE, URL: s/WEBLIB_PTPP_SC.HOMEPAGE.FieldFormula.IScript_SCP (133,4)
    PT_SC_PGT_MAIN_MENU already exists. (96,3)
    Copy of the Main Menu Pagelet From PS_SITETEMPLATE to Portal: EMPLOYEE failed. (219,2111)
    Message Set Number: 219
    Message Number: 2111
    Message Reason: Copy of the Main Menu Pagelet From PS_SITETEMPLATE to Portal: EMPLOYEE failed. (219,2111)
    I checked table PSPRSMDEFN which does not have an entry for PT_SC_PGT_MAIN_MENU, under the Employee Portal. I tried to migrate the missing Portal Registry object using App Designer but again receive the "duplicate key" error.
    So it seems that I have to find the duplicate key and resolve it before I can migrate the missing object.
    Anyone know a quick way to figure out what the duplicate keys are?
    Thanks

    I tried several things to find the duplicates with no success.
    A couple of workarounds were attempted that resulted in the same "duplicate key" error, including:
    a) Re-copying file project PPLTLS84CUR
    b) Copy object 'PT_SC_PGT_MAIN_MENU" from Demo
    After opening an SR, the successful workaround was to use Data Mover to export from Demo the "EMPLOYEE" portal entries for "PT_SC_PGT_MAIN_MENU" from tables PSPRSMDEFN, PSPRSMSYSATTR and PSPRSMSYSATTRVL. The import to the target upgrade environment was successful. A re-run of PTUPGCONVERT finished successfully.
    The upgrade is progressing but where the duplicate keys are is still a mystery.
    Cheers

  • Possible to code a Find/Find Next feature for use inside a Table Control

    Hello,
    I have a Table Control that displays many lines.  Is it possible to code a Find/Find Next feature that would allow the user to enter a 'keyword' then search each line of the Table Control for existing matches?
    I have provided the user with various Selection Criteria that will filter the table control results, but there are still too many lines to visually scan for the desired result.
    I am guessing that I would place an input box and a 'Find' button onto my layout screen. Then in user command, I have to scroll through each line of the table control and check every value to see if the string contains 'keyword' When found, stop  and display table control assigning current line as Top line?
    Am I on the right track or is there a better solution already?
    Kind Regards,
    MPersson

    I've done that. It works pretty well. You might want to allow the user to search only in selected column(s) as well.
    Rob

  • Cannot find a field for creating a condition table

    Hi all,
    I m trying to create a shipment scenarios which involves shipment cost based on prices,boxes,material....etc. to start with i tried to create a condition table, here the key combination needs to have the filed 'boxes' in it. I am not able to find it even in the master table. Is there any other place whr i can find it or how can i add this into the list?(master table)
    any input is highly appreciated.
    regards/aryan.

    Hi
    Try to ad the filed from the field catalog ,In case the required combination field is not there u can add the field through the following process to filed catalog and create the condition table.
    It is most common that one or other time we need to use this function while configuring multi tasking & complex Pricing Architecture.
    Here Aim giving a simple guide to add fields to the Pricing Field Catalogues:
    For example you want to use field PSTYV ('Sales document item category') that is included in structure KOMP ('Pricing Communication Item') as a key for a condition table.
    When you create a condition table (Transaction V/03), however, the system does not propose the field in the field catalog.
    Condition access, field catalog, allowed fields, KOMG, KOMK, KOMP, KOMPAZ, KOMKAZ, PSTYV are the other terms which we need to know about, to add Fields.
    Reason and Prerequisites
    For technical reasons, field PSTYV was included in structure KOMP, however, not in structure KOMG ('Allowed Fields for Condition Structures').
    Proceed as follows:
    1. Call up the ABAP Dictionary (Transaction SE11) and create data type ZZPSTYV. Choose PSTYV as a domain.As a short text, you can use, for example, 'ZZ - sales document item category' and as a field label, you can use the field labels of PSTYV.Save, check and activate your entries.
    2. Call up structure KOMPAZ in the ABAP Dictionary (Transaction SE11) in the change mode and make the following entry:
    Component Component type
    ZZPSTYV ZZPSTYV
    Save, check and activate the change you made.
    3. Note:Because of the change in structure KOMPAZ, field ZZPSTYV is now known in structures KOMG and KOMP because structure KOMPAZ is included in both structures.
    4. Call up Transaction SPRO. Navigate to 'Sales and Distribution -> Basic Functions -> Pricing -> Pricing Control' and execute 'Define Condition Tables'.
    Choose 'Conditions: Allowed fields' and include ZZPSTYV as a new entry.
    5. Note:Now you can use field ZZPSTYV as a key field when you create a condition table Axxx.
    6. Supply the new field you defined by including the following source code line in USEREXIT_PRICING_PREPARE_TKOMP:
    MOVE xxxx-PSTYV TO TKOMP-ZZPSTYV.
    In order processing you find the user exit in Include MV45AFZZ, and in billing document processing you find it in Include RV60AFZZ.
    Consider that you can also use this note as a help if you want to use other customer-specific fields as key fields in a condition table.
    For header fields, use structure KOMKAZ instead of structure KOMPAZ and USEREXIT_PRICING_PREPARE_TKOMK instead of USEREXIT_PRICING_PREPARE_TKOMP.
    For more information, see Transaction SPRO via the path 'Sales and Distribution -> System Modifications -> Create New Fields (Using Condition Technique) -> New Fields for Pricing' and OSS Note 21040.

  • Where can I find development class for created by me table

    Hi Gurus
    I've created a table ZTEST and I have added it to development class ZGENERAL. My question is how can I in report knowing the name of table find to what development class it was assigned?
    Thank you for all helpful answers.
    BR
    Marcin Cholewczuk

    Hi
    Table TADIR
    Passs
    PGMID  =  R3TR
    OBJECT =   TABL  
    OBJ_NAME = MARA
    and you can find the Package in DEVCLASS fields
    Cheerz
    Ram

  • PL/SQL-find out extra rows present in  table by comparing 2 similar tables

    Hi, can any one give me an idea to find out the extra rows present in table by comparing 2 similar tables using pl/sql.
    REQUIREMENT::i am working on the upgrade environment.my previous database has some tables and having data.Now functional folks are adding some new data to the existing tables for the upgrade database.I need to identify that new rows which are added by them.
    for this , i created name table with 2 columns n,n1 which contains the table names.
    Table Name:Name
    columns:n n1
    a ax
    b bx
    c cx
    a,b c........are the table names which are in the previous database environment.(approx >1500 tables)These tables having data.
    ax,bx,cx..........table names which are in the upgrade environment contains the extra data which is added by the functional folks.
    a&ax,b&bx.................(approx 1500 tables) are having same structure except some of them.
    Now i want to write a pl/sql program that reads both table names a&ax from name table and then by comparing the rows of a&ax ,i need to find out the extra rows present in the ax table to store that in different place.
    Example:
    a table
    id name
    1 co
    2 wi
    3 il
    ax table
    id name
    1 co
    2 wi
    3 il
    4 va
    5 ca
    Here i need to find out the difference b/n the 2 tables ,the extra rows id 4,5 and place it some where.

    this is just for demo, is this you mean?
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT empno,ename,e.DEPTNO emp_deptno, d.deptno dept_deptno,d.DNAME
      2  FROM EMP e full outer join DEPT d
      3* on d.DEPTNO= e.DEPTNO
    SQL> /
         EMPNO ENAME      EMP_DEPTNO DEPT_DEPTNO DNAME
          7934 MILLER             10          10 ACCOUNTING
          7839 KING               10          10 ACCOUNTING
          7782 CLARK              10          10 ACCOUNTING
        snipp........
          7521 WARD               30          30 SALES
          7499 ALLEN              30          30 SALES
          156 1
    12 1
    40 OPERATIONS
    90 LOGISTIC
    18 rows selected.
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT empno,ename,e.DEPTNO emp_deptno, d.deptno dept_deptno,d.DNAME
      2  FROM EMP e left outer join DEPT d
      3* on d.DEPTNO= e.DEPTNO
    SQL> /
         EMPNO ENAME      EMP_DEPTNO DEPT_DEPTNO DNAME
          7934 MILLER             10          10 ACCOUNTING
          7839 KING               10          10 ACCOUNTING
          7782 CLARK              10          10 ACCOUNTING
          7902 FORD               20          20 RESEARCH
        snipp..................
          7654 MARTIN             30          30 SALES
          7521 WARD               30          30 SALES
          7499 ALLEN              30          30 SALES
           156 1
    12 1
    16 rows selected.
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT empno,ename,e.DEPTNO emp_deptno, d.deptno dept_deptno,d.DNAME
      2  FROM EMP e[b] right outer join  DEPT d
      3* on d.DEPTNO= e.DEPTNO
    SQL> /
         EMPNO ENAME      EMP_DEPTNO DEPT_DEPTNO DNAME
          7369 SMITH              20          20 RESEARCH
          7499 ALLEN              30          30 SALES
          7521 WARD               30          30 SALES
          7566 JONES              20          20 RESEARCH
          snipp......................
          7902 FORD               20          20 RESEARCH
          7934 MILLER             10          10 ACCOUNTING
                                             40 OPERATIONS
    90 LOGISTIC
    16 rows selected.

  • Find the key for join between table "crhd" and "equi" for use field "answt"

    I make program for read data from table "crhd" for print  about machine report
    but I can not find the key for link join to table "equi" for print field "answt" (acquistion value)
    please help me  find the key field for join between table "crhd" and "equi" for use field "answt"
    thank you very much...

    This is how the Work Center is linked to a particular Equipment -
    Functional - In IE03 ( view Equipments) You see the Work Center of a particular Equipment.
    Technical - Go to view V_EQUI ( view of EQUI and EQUZ). Pass the Equipment number alongwith V_EQUI-PM_OBJTY = 'A' ( i,.e searching for the Object Type Work Center).  In this way u ll get the V_EQUI-GEWRK - this is the Work Center ID.
    You can pass this Work Center ID to CRHD. And you will get the Work Center text.
    CRHD-OBJTY = 'A'
    CRHD-OBJID = V_EQUI-GEWRK.
    and u ll get the CRHD-ARBPL - this is the Work Center.
    So u need to come backwards, alongwith ur CRHD-OBJTY and CRHD-OBJID , you pass the same to V_EQUI and u get the list of equipment numbers alongwith ur ANSWT(Acquisition value).
    I guess it solves ur problem.

  • Number of rows in each table

    Hi
    How to find the number of rows in each table of a database by just using a SQL query,
    and should not use the data dictionary tables also... is there any way...??
    Thanks
    MJ

    It can be done in a single SQL like ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>SELECT table_name,
      2         DBMS_XMLGEN.getxmltype ('SELECT Count(*) c FROM ' || table_name).EXTRACT ('//text()').ge
    tnumberval() tot_rows
      3  FROM user_tables;
    TABLE_NAME                       TOT_ROWS
    QUESTIONTYPE                            0
    SRGROUPTABLE                            1
    ST_TEST                                 4
    REGISTER                                0
    DEB_1                                   2
    EMP1                                    0
    6 rows selected.
    Elapsed: 00:00:12.04Credit goes to Michael. ;)
    Regards.
    Satyaki De.

  • TableView Control(finding total no of Rows & Columns)

    Dear ALL SDN Members,
    Please tell me the method by which we can obtain total no. of rows and columns in TableView control.

    Hi,
    You can use Describe internal table to find the Number of Rows in the table control.or tablecontrol-lines will give the number of rows.
    for getting the number of columns you have to call the FM <b>REUSE_ALV_FIELDCATALOG_MERGE</b>
    data: v_lines type i.
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = sy-repid
       I_INTERNAL_TABNAME           = 'ITAB'
       I_INCLNAME                   = sy-repid
      changing
        ct_fieldcat                  = IT_FIELDCAT
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    describe table it_fieldcat lines v_lines.
    now v_lines will have the number of columns.
    Regards
    vijay

Maybe you are looking for

  • Computer reboots when connecting ipod to USB cable.

    Has this happened to anyone else? All of a sudden now, whenever I connect my ipod to the USB cable, it makes my computer reboot! And it doesn't stop rebooting until I disconnect the ipod! I have no idea why this is happening, and I don't know how to

  • Windows 8.1 - Update 1 requirements

    Hi, Has anyone come across a list of prerequisite updates that Windows 8.1 Update 1 (KB2919355) requires ?  According to the link below, it particularly needs KB2919442, but doing some testing & manual installing, it looks like it needs more updates

  • Using "comment" as xml tag in XSLT

    Comment is apparently reserved word in XSLT. Is there a way to put in a tag set in the destination xml document using XSL, something like this: <comment><FreeFormText>This is a test</FreeFormText></comment>. When I try to do this all I get in the des

  • New magic mouse

    Don't know where to go. With the new mouse how do I go about copy and paste. I usually hi-lite, press the left and a menu came down to "copy" Can't seem to do that with the new mouse?

  • Veeam backing up a passive DAG member with an active Public Folder DB on it.?

    Hi, Anyone here using VEEAM 7 to backup exchange 2010 sp2 (yes.. I know)? We have a DAG with two nodes. They are VMware machines. We are having issues with the backups. Specifically getting many many vss writer timeouts when snapshoting the machine a