Extended VO results in duplicate rows

Hi,
I have entended a VO and added one more field to the VO query. But now that VO is displaying duplicate rows. I executed same query from sql plus but there it is returning unique rows. What can be the reason? Is there something I had missed while extending VO.
Thanks in advance.
Hitesh

Hitesh,
How exactly did you do the extension and applied it?
Put some debugging code to print the query and row counts and recheck.
--Shiv                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Order by results in duplicates rows returned

    Hi All,
    Just got the following question that I could not understand at all. Let's assume we have a query like this:
    select d.d_name, e.e_name
    from dept d, emp e
    where d.d_id = e.d_id
    And this query returns 3 rows only:
    IT JOHN
    IT JAMES
    ADMIN BILL
    It was found that if the query was changed as:
    select d.d_name, e.e_name
    from dept d, emp e
    where d.d_id = e.d_id
    ORDER BY d.d_name, d.e_name
    sometimes it returns as 4 rows instead of 3:
    ADMIN BILL
    IT JAMES
    IT JAMES
    IT JOHN
    How this be possible?
    This happened sometimes on windows platform.

    Hi All,
    Just got the following question that I could not understand at all. Let's assume we have a query like this:
    select d.d_name, e.e_name
    from dept d, emp e
    where d.d_id = e.d_id
    And this query returns 3 rows only:
    IT JOHN
    IT JAMES
    ADMIN BILL
    It was found that if the query was changed as:
    select d.d_name, e.e_name
    from dept d, emp e
    where d.d_id = e.d_id
    ORDER BY d.d_name, d.e_name
    sometimes it returns as 4 rows instead of 3:
    ADMIN BILL
    IT JAMES
    IT JAMES
    IT JOHN
    How this be possible?
    This happened sometimes on windows platform.

  • Wierd duplicate rows problem

    Hi,
    I've a partitioned table and when I query to extract primary keys for a particular month, I'm getting wierd results. Here is what is happening -
    SELECT colA, colB, colC
    FROM tableA partition(Y06M01)
    WHERE current = 'Y'
    -- This query is returning me some duplicate rows for colA, colB, colC when these columns form primary key on tableA. Note that, rowids for these rows are not repeating, which makes me think oracle is actually storing these duplicate rows on the drive.
    Now, for the values that are repeating in the above query, following query doesnt result in duplicate rows (note that I'm not mentioning partition name in the from clause) -
    SELECT colA, colB, colC
    FROM tableA
    WHERE current = 'Y'
    AND (
    (colA = <val1> AND colB = <val2> AND colC = <val3>)
    OR
    (colA = <val4> AND colB = <val5> AND colC = <val6>)
    OR
    (colA = <val7> AND colB = <val8> AND colC = <val9>)
    Does anyone know why such a thing is happening? is it some kind of internal oracle error?
    Thanks

    Answers to your questions
    FROM tableA partition(Y06M01)Why have you need to query against the partition instead of table level ?
    -- There's no need, but the rows that are repeating lie in this partition. Hence, querying against the partition or against the table should return same results.
    colA, colB, colC when these columns form primary key on tableAAre they a primary key created ?
    -- Yes there's is a primary key created on these columns.
    Anyway, have you just some example output to show us.
    -- Here is the sample output:
    Scenario I (If I query against the partition). In this case if i extract rowids, they are different for each of below selected 6 rows
    colA colB colC
    1 2 3
    4 5 6
    4 5 6
    4 5 6
    7 8 9
    7 8 9
    Scenario II (If I query against the table for values (1,2,3), (4,5,6) and (7,8,9))
    colA colB colC
    1 2 3
    4 5 6
    7 8 9
    Furthermore, generally, to see the duplicate rows, try this query :
    select colA, colB, colC, count(*)
    from tableA
    having count(*)>1;
    -- I did run this query and again if I query against the partition I see duplicate rows and when I query against the table there are no duplicate rows.

  • View results in more ROW then Select.

    Hello,
    I am trying to create a view and for some reason when I just run the select statement of that view, i get 11 rows. But when i create the view, i get 106 rows.
    I am really stomped and need to know what's causing this.
    -----------------------------When i execute this view, i get 106 rows -----------------------
    CREATE OR REPLACE VIEW REGRPT_CONS_SPECIAL_FEE_VIEW
    (REG_CONFERENCE_ID, COMPANY, CONF_REFERENCE_CODE, CONF_DESCRIPTION, REG_SESSION_ID,
    SESS_REFERENCE_CODE, BEGIN_DATE, END_DATE, SESS_DESCRIPTION, CONSULTANT_ID,
    SPECIAL_FEE_AMOUNT, REASON, REGISTERED)
    AS
    SELECT DISTINCT RCC.REG_CONFERENCE_ID
         , RCC.COMPANY
         , RC.REFERENCE_CODE
         , RCT.DESCRIPTION
         , RS.ID
         , RS.REFERENCE_CODE
         , RS.BEGIN_DATE
         , RS.END_DATE
         , RST.non_html_DESCRIPTION
         , rsf.consultant_no
         , rsf.fee_amount
         , rsf.reason
         , 'Y'
    FROM reg_conference_company@webtst rcc
         , reg_conference@webtst rc
         , reg_conference_type@webtst rct
         , reg_session@webtst rs
         , reg_session_t@webtst rst
         , locale@webtst l
         , reg_special_fee@webtst rsf
         , reg_consultant@webtst rcons
    WHERE rcc.reg_conference_id = rc.ID
    AND rc.reg_conference_type_id = rct.ID
    AND RC.ID = RS.REG_CONFERENCE_ID
    AND rs.ID = rst.reg_session_id
    AND rst.locale_id = l.ID
    AND l.language_id = '1'
    AND L.COMPANY = RCC.COMPANY
    AND rc.ID = rsf.reg_conference_id
    AND rcc.company = rsf.company
    AND rs.ID = rcons.reg_session_id
    AND rsf.company = rcons.company
    AND rsf.consultant_no = rcons.consultant_no
    AND rcons.status <> 'C'
    UNION
    --- consultants not registered and in special fee
    SELECT DISTINCT RCC.REG_CONFERENCE_ID
         , RCC.COMPANY
         , RC.REFERENCE_CODE
         , RCT.DESCRIPTION
         , RS.ID
         , RS.REFERENCE_CODE
         , RS.BEGIN_DATE
         , RS.END_DATE
         , RST.non_html_DESCRIPTION
         , rsf.consultant_no
         , rsf.fee_amount
         , rsf.reason
         , 'N'
    FROM reg_conference_company@webtst rcc
    , reg_conference@webtst rc
    , reg_conference_type@webtst rct
    , reg_session@webtst rs
    , reg_session_t@webtst rst
    , locale@webtst l
    , reg_special_fee@webtst rsf
    WHERE rcc.reg_conference_id = rc.ID
    AND rc.reg_conference_type_id = rct.ID
    AND RC.ID = RS.REG_CONFERENCE_ID
    AND rs.ID = rst.reg_session_id
    AND rst.locale_id = l.ID
    AND l.language_id = '1'
    AND L.COMPANY = RCC.COMPANY
    AND rc.ID = rsf.reg_conference_id
    AND rcc.company = rsf.company
    AND (rsf.company || rsf.consultant_no) NOT IN
                                  (SELECT (company ||consultant_no)
                                  FROM reg_consultant@webtst
                                  WHERE status <> 'C'
                                  AND reg_session_id = rs.ID)
    --------------When i run this select i get 11 rows ----------------------------
    SELECT DISTINCT RCC.REG_CONFERENCE_ID
         , RCC.COMPANY
         , RC.REFERENCE_CODE
         , RCT.DESCRIPTION
         , RS.ID
         , RS.REFERENCE_CODE
         , RS.BEGIN_DATE
         , RS.END_DATE
         , RST.non_html_DESCRIPTION
         , rsf.consultant_no
         , rsf.fee_amount
         , rsf.reason
         , 'Y'
    FROM reg_conference_company@webtst rcc
         , reg_conference@webtst rc
         , reg_conference_type@webtst rct
         , reg_session@webtst rs
         , reg_session_t@webtst rst
         , locale@webtst l
         , reg_special_fee@webtst rsf
         , reg_consultant@webtst rcons
    WHERE rcc.reg_conference_id = rc.ID
    AND rc.reg_conference_type_id = rct.ID
    AND RC.ID = RS.REG_CONFERENCE_ID
    AND rs.ID = rst.reg_session_id
    AND rst.locale_id = l.ID
    AND l.language_id = '1'
    AND L.COMPANY = RCC.COMPANY
    AND rc.ID = rsf.reg_conference_id
    AND rcc.company = rsf.company
    AND rs.ID = rcons.reg_session_id
    AND rsf.company = rcons.company
    AND rsf.consultant_no = rcons.consultant_no
    AND rcons.status <> 'C'
    UNION
    --- consultants not registered and in special fee
    SELECT DISTINCT RCC.REG_CONFERENCE_ID
         , RCC.COMPANY
         , RC.REFERENCE_CODE
         , RCT.DESCRIPTION
         , RS.ID
         , RS.REFERENCE_CODE
         , RS.BEGIN_DATE
         , RS.END_DATE
         , RST.non_html_DESCRIPTION
         , rsf.consultant_no
         , rsf.fee_amount
         , rsf.reason
         , 'N'
    FROM reg_conference_company@webtst rcc
    , reg_conference@webtst rc
    , reg_conference_type@webtst rct
    , reg_session@webtst rs
    , reg_session_t@webtst rst
    , locale@webtst l
    , reg_special_fee@webtst rsf
    WHERE rcc.reg_conference_id = rc.ID
    AND rc.reg_conference_type_id = rct.ID
    AND RC.ID = RS.REG_CONFERENCE_ID
    AND rs.ID = rst.reg_session_id
    AND rst.locale_id = l.ID
    AND l.language_id = '1'
    AND L.COMPANY = RCC.COMPANY
    AND rc.ID = rsf.reg_conference_id
    AND rcc.company = rsf.company
    AND (rsf.company || rsf.consultant_no) NOT IN
                                  (SELECT (company ||consultant_no)
                                  FROM reg_consultant@webtst
                                  WHERE status <> 'C'
                                  AND reg_session_id = rs.ID)

    I don't know the reason, but here is what I would do to narrow the search for it.
    Remove all DISTINCT operators and replace UNION with UNION ALL. Compare the result (number of rows) for the select and for the View.
    If it is the same, then you have some problem with duplicate values. If not you have two different selects (compare execution plan too) or different data (does it run in the same schema?).
    Then add step by step a DISTINCT and check how the result changes. Start analyzing only this part of the query.

  • How to delete duplicate row in certain case

    Hi all,</p>
    <p>I need you help to delete my duplicate row.</p>
    <p>Sample Data in table (<b>table1</b>)</p>
    <p style="margin-top: 0; margin-bottom: 0"> </p>
    <p style="margin-top: 0; margin-bottom: 0"><b>Timein       
    DateIn           
    locationin        useridin       
    status</b></p>
    <p style="margin-top: 0; margin-bottom: 0">08:20:00    01/09/2007       
    0001               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">08:10:30    01/09/2007       
    0004               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">07:20:00    01/09/2007       
    0006               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">08:14:00    01/09/2007       
    0001               
    U02               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">06:10:30    01/09/2007       
    0004               
    U02               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">08:10:10    01/09/2007       
    0006               
    U02               
    1</p>
    <p> </p>
    <p>I need to delete the row in table1 and leave the minimum <b>timein</b> in
    that table by <b>useridin</b>.</p>
    <p>The last output in table1 is like below.</p>
    <p style="margin-top: 0; margin-bottom: 0"><b>Timein       
    DateIn           
    locationin        useridin       
    status</b></p>
    <p style="margin-top: 0; margin-bottom: 0">07:20:00    01/09/2007       
    0006               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">06:10:30    01/09/2007       
    0004               
    U02               
    1</p>
    <p>Can i used below  sql to output the result;</p>
    <font FACE="Courier" SIZE="2">
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">delete</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">from</font><font FACE="Courier" SIZE="2">
    <font color="#808000">table1</font> t1 </font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">where</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2" COLOR="#ff0000">rowid</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">&gt;</p>
    </font><font FACE="Courier" SIZE="2">
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">(</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">select</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">min(</font><font FACE="Courier" SIZE="2">t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2" COLOR="#ff0000">rowID</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">)</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">from</font><font FACE="Courier" SIZE="2">
    <font color="#808000">table1</font> t2</p>
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">where</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font face="Courier" size="2">Datein
    = t2.Datein</font></p>
    <font FACE="Courier" SIZE="2">
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">and</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2">Status
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">=</font><font FACE="Courier" SIZE="2">
    t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2">Status</font></p>
    <p style="margin-top: 0; margin-bottom: 0">
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">and</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font>UserIdin
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">=</font><font FACE="Courier" SIZE="2">
    t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font>UserIdin
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">order by t2.timein);</font></p>
    <p style="margin-top: 0; margin-bottom: 0"> </p>
    <p style="margin-top: 0; margin-bottom: 0"><font face="Courier" size="2">Thanks
    in advanced

    Hi Rob,
    Just trying to chip in little bit!
    Created Table As follows same as you, only two rows with duplicatem user, datein, and timein:
    create table table1
    as
    select '08:20:00' timein, date '2007-09-01' datein, '0001' locationin, 'U01' useridin, 1 status from dual union all
    select '08:10:30', date '2007-09-01', '0004', 'U01', 1 from dual union all
    select '07:20:00', date '2007-09-01', '0006', 'U01', 1 from dual union all
    select '08:14:00', date '2007-09-01', '0001', 'U02', 1 from dual union all
    select '06:10:30', date '2007-09-01', '0004', 'U02', 1 from dual union all
    select '06:10:30', date '2007-09-01', '0001', 'U02', 1 from dual
    If I run your delete statement result row will be as follows:
    SQL> select * from table1;
    TIMEIN DATEIN LOCA USE STATUS
    07:20:00 01-SEP-07 0006 U01 1
    06:10:30 01-SEP-07 0004 U02 1
    06:10:30 01-SEP-07 0001 U02 1
    Here problem is that its not able to delete duplicate rows having same timein and timeout.
    So I changed you query as follows:
    DELETE FROM tab1
    WHERE rowid NOT IN (
         SELECT     MIN(rowid)
         FROM     tab1
         WHERE     (UseridIn, TO_DATE(TO_CHAR(DateIn,'YYYYMMDD') || TimeIn,'YYYYMMDDHH24:MI:SS')) IN
              (     SELECT     UseridIn, MIN(TO_DATE(TO_CHAR(DateIn,'YYYYMMDD') || timein,'YYYYMMDDHH24:MI:SS'))
                   FROM     tab1
                   GROUP BY UseridIn)
         GROUP BY UseridIn
    If I run your delete statement with little bit of changes, the result row was as follows:
    SQL> select * from table1;
    TIMEIN DATEIN LOCA USE STATUS
    07:20:00 01-SEP-07 0006 U01 1
    06:10:30 01-SEP-07 0004 U02 1
    Regards,
    Raj

  • How to update duplicate row from table

    Hi,
    how to update duplicate row from table?
    First to find duplicate row then update duplicate row with no to that duplicate row in oracle.
    can you give me suggestion on it?
    Thanks in advance.
    your early response is appreciated...

    In order to find a duplicate row, see:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1224636375004
    (or search this forum, your question has been asked before)
    In order to update it, just create and use an Oracle sequence, have it start and increment at a value that doesn't exist in your table.
    If that doesn't get you going, post some CREATE TABLE + INSERT INTO statements, and the results you want from them, in other words: a complete testcase.

  • SQL Server 2014 - Delete duplicate rows in a table except one

    Hi all,
    I have a table that contains duplicate rows. Using grouping I can easily identify those rows.
    As of now, I count the grouped records and copy one of the group in a temporary table together with its count of elements. Than I loop over this table and delete N - 1 rows of each group from the original table. Unfortunately this is done with two cursors
    and WHILE loops.
    Is anybody out there who could give some hints how to handle deletion of duplicated rows leaving one in place using pure SQL? I tried a full delete of all elements of a group and then an INSERT of one row to recreate a row again. But this is not
    very elegant and close to using cursors.
    Regards Uwe

    Hi all,
    based on input below from Uri, I have developed a little more general solution for removal of duplicates. I did that, because I'm sure that for many beginners in SQL it is easier specialize a proposal by removing parts of it than adding new functionality.
    Here is my code.
    -- Remove duplicates from a table and document the deleted rows
    DECLARE @MyTable Table (Col1 int, Col2 int, Col3 int, Col4 int);
    DECLARE @OutTable Table (Col1 int, Col2 int, Col3 int, Col4 int);
    INSERT INTO @MyTable VALUES
    (1, 10, 100, 7),
    (2, 20, 200, 2),
    (2, 20, 200, 1),
    (3, 30, 300, 3),
    (1, 10, 200, 4),
    (1, 10, 100, 5),
    (1, 10, 100, 6);
    WITH cte (RN, Col1, Col2, Col3, Col4)
    AS (SELECT ROW_NUMBER() OVER (PARTITION BY Col1, Col2, Col3 ORDER BY (SELECT 0)) AS RN, Col1, Col2, Col3, Col4
    FROM @MyTable)
    DELETE FROM cte
    OUTPUT DELETED.Col1, DELETED.Col2, DELETED.Col3, DELETED.Col4
    INTO @OutTable (Col1, Col2, Col3, Col4)
    WHERE RN > 1;
    SELECT * FROM @OutTable;
    And this is the result:
    The MS 139444 article Satish mentioned is focussed on duplicate PKs removal. Thanks for the hint.
    Thanks to you all for your rapid response.
    Regards Uwe

  • First attempt to remove duplicate rows from a table...

    I have seen many people asking for a way to remove duplicate rows from data. I made up a fairly simple script. It adds a column to the table with the cell selected in it, and adds the concatenation of the data to the left into that new column. then it reads that into a list, and walks through that list to find any that are listed twice. Any that are it marks for DELETE.
    It then walks through to find each one marked for delete and removes them (you must go from bottom to top to do this, otherwise your row markings for delete don't match up to the original rows anymore). Last is to delete the column we added.
    tell application "Numbers"
    activate
    tell document 1
    -- DETERMINE THE CURRENT SHEET
    set currentsheetindex to 0
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of (tables whose selection range is not missing value)
    end tell
    if x is not 0 then
    set the currentsheetindex to i
    exit repeat
    end if
    end repeat
    if the currentsheetindex is 0 then error "No sheet has a selected table."
    -- GET THE TABLE WITH CELLS
    tell sheet currentsheetindex
    set the current_table to the first table whose selection range is not missing value
    end tell
    end tell
    log current_table
    tell current_table
    set list1 to {}
    add column after column (count of columns)
    set z to (count of columns)
    repeat with j from 1 to (count of rows)
    set m to ""
    repeat with i from 1 to (z - 1)
    set m to m & value of (cell i of row j)
    end repeat
    set value of cell z of row j to m
    end repeat
    set MyRange to value of every cell of column z
    repeat with i from 1 to (count of items of MyRange)
    set n to item i of MyRange
    if n is in list1 then
    set end of list1 to "Delete"
    else
    set end of list1 to n
    end if
    end repeat
    repeat with i from (count of items of list1) to 1 by -1
    set n to item i of list1
    if n = "Delete" then remove row i
    end repeat
    remove column z
    end tell
    end tell
    Let me know how it works for y'all, it worked good on my machine, but I know localization is causing errors sometimes when I post things.
    Thanks,
    Jason
    Message was edited by: jaxjason

    Hi jason
    I hope that with the added comments it will be clear.
    Ask if something is always opaque.
    set {current_Range, current_table, current_Sheet, current_Doc} to my getSelection()
    tell application "Numbers09"
    tell document current_Doc to tell sheet current_Sheet to tell table current_table
    set list1 to {}
    add column after column (count of columns)
    set z to (count of columns)
    repeat with j from 1 to (count of rows)
    set m to ""
    tell row j
    repeat with i from 1 to (z - 1)
    set m to m & value of cell i
    end repeat
    set value of cell z to m
    end tell
    end repeat
    set theRange to value of every cell of column z
    repeat with i from (count of items of theRange) to 1 by -1
    (* As I scan the table backwards (starting from the bottom row),
    I may remove a row immediately when I discover that it is a duplicate *)
    set n to item i of theRange
    if n is in list1 then
    remove row i
    else
    set end of list1 to n
    end if
    end repeat
    remove column z
    end tell
    end tell
    --=====
    on getSelection()
    local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
    tell application "Numbers09" to tell document 1
    set theSheet to ""
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of tables
    if x > 0 then
    repeat with y from 1 to x
    (* Open a trap to catch the selection range.
    The structure of this item
    «class
    can't be coerced as text.
    So, when the instruction (selection range of table y) as text
    receive 'missing value' it behaves correctly and the lup continue.
    But, when it receive THE true selection range, it generates an error
    whose message is errMsg and number is errNum.
    We grab them just after the on error instruction *)
    try
    (selection range of table y) as text
    on error errMsg number errNum (*
    As we reached THE selection range, we are here.
    We grab the errMsg here. In French it looks like:
    "Impossible de transformer «class
    The handler cuts it in pieces using quots as delimiters.
    item 1 (_) "Impossible de transformer «class » "
    item 2 (theRange) "A2:M25"
    item 3 (_) " of «class NmTb» "
    item 4 (theTable) "Tableau 1"
    item 5 (_) " of «class NmSh» "
    item 6 (theSheet) "Feuille 1"
    item 7 (_) " of document "
    item 8 (theDoc) "Sans titre"
    item 9 ( I drop it ) " of application "
    item 10 ( I drop it ) "Numbers"
    item 11 (I drop it ) " en type string."
    I grab these items in the list
    {_, theRange, _, theTable, _, theSheet, _, theDoc}
    Yes, underscore is a valid name of variable.
    I often uses it when I want to drop something.
    An alternate way would be to code:
    set ll to my decoupe(errMsg, quote)
    set theRange to item 2 of ll
    set theTable to item 4 of ll
    set theSheet to item 8 of ll
    set theDoc to item 10 of ll
    it works exactly the same but it's not so elegant.
    set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
    exit repeat (*
    as we grabbed the interesting datas, we exit the lup indexed by y.*)
    end try
    end repeat -- y
    if theSheet > "" then exit repeat (*
    If we are here after grabbing the datas, theSheet is not "" so we exit the lup indexed by i *)
    end if
    end tell -- sheet
    end repeat -- i
    (* We may arrive here with two kinds of results.
    if we grabbed a selection, theSheet is something like "Feuille 1"
    if we didn't grabbed a selection, theSheet is the "" defined on entry
    and we generate an error which is not trapped so it stops the program *)
    if theSheet = "" then error "No sheet has a selected table."
    end tell -- document
    (* Now, we send to the caller the interesting datas :
    theRange "A2:M25"
    theTable "Tableau 1"
    theSheet "Feuille 1"
    theDoc "Sans titre" *)
    return {theRange, theTable, theSheet, theDoc}
    end getSelection
    --=====
    on decoupe(t, d)
    local l
    set AppleScript's text item delimiters to d (*
    Cut the text t in pieces using d as delimiter *)
    set l to text items of t
    set AppleScript's text item delimiters to "" (*
    Resets the delimiters to the standard value. *)
    (* Send the list to the caller *)
    return l
    end decoupe
    --=====
    Have fun
    And if it's not clear enough, you may ask for more explanations.
    Yvan KOENIG (from FRANCE mardi 27 janvier 2009 21:49:19)

  • Duplicate Rows In Oracle Pipelined Table Functions

    Hi fellow oracle users,
    I am trying to create an Oracle piplined table function that contains duplicate records. Whenever I try to pipe the same record twice, the duplicate record does not show up in the resulting pipelined table.
    Here's a sample piece of SQL:
    /* Type declarations */
    TYPE MY_RECORD IS RECORD(
    MY_NUM INTEGER
    TYPE MY_TABLE IS TABLE OF MY_RECORD;
    /* Pipelined function declaration */
    FUNCTION MY_FUNCTION RETURN MY_TABLE PIPELINED IS
    V_RECORD MY_RECORD;
    BEGIN
    -- insert first record
    V_RECORD.MY_NUM = 1;
    PIPE ROW (V_RECORD);
    -- insert second duplicate record
    V_RECORD.MY_NUM = 1;
    PIPE ROW (V_RECORD);
    -- return piplined table
    RETURN;
    END;
    /* Statement to query pipelined function */
    SELECT * FROM TABLE( MY_FUNCTION ); -- for some reason this only returns one record instead of two
    I am trying to get the duplicate row to show up in the select statement. Any help would be greatly appreciated.

    Can you provide actual output from an SQL*Plus prompt trying this? I don't see the same behavior
    SQL> SELECT * FROM V$VERSION;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> CREATE TYPE MY_RECORD IS OBJECT(MY_NUM INTEGER);
      2  /
    Type created.
    SQL> CREATE TYPE MY_TABLE IS TABLE OF MY_RECORD;
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION MY_FUNCTION
      2  RETURN MY_TABLE
      3  PIPELINED
      4          AS
      5                  V_RECORD        MY_RECORD;
      6          BEGIN
      7                  V_RECORD.MY_NUM := 1;
      8                  PIPE ROW(V_RECORD);
      9
    10                  V_RECORD.MY_NUM := 1;
    11                  PIPE ROW(V_RECORD);
    12
    13                  RETURN;
    14          END;
    15  /
    Function created.
    SQL> SELECT * FROM TABLE(MY_FUNCTION);
                  MY_NUM
                       1
                       1

  • Duplicate rows in Oracle

    What would cause Oracle to insert duplicate rows into a table? Could a join of two tables in the initial query assigned to an application page cause ORacle to insert an extra row into a table when an update to data value occurs? I have no insert triggers and no foreign keys assigned to the table. I am not sure what would cause Oracle to assume that an insert of a row must occur. I want to prevent that insert.

    V Rickert wrote:
    What would cause Oracle to insert duplicate rows into a table? Could a join of two tables in the initial query assigned to an application page cause ORacle to insert an extra row into a table when an update to data value occurs? I have no insert triggers and no foreign keys assigned to the table. I am not sure what would cause Oracle to assume that an insert of a row must occur. I want to prevent that insert.Is there an APEX dimension to this? If so, tell us the full APEX and DB versions, and provide full details of what the APEX app is doing (a debug trace of page accept processing is the obvious place to start).
    The most likely explanations are:
    1. There is no duplicate in the table but there is a join problem in the query reporting on it, resulting in the appearance of a duplicate in the reults. Have you confirmed that the duplicate is really a physical row in the table?
    2. There is an APEX page/application process containing an insert on the table that is unexpectedly running on page accept due to it having no condition or an incorrect condition. This will be visible in the Debug trace.

  • Duplicate rows in 5 table

    I have five tables(A,B,C,D,E), and I am trying to check for duplicate rows in all the tables, I tried using inner join, but the first three join did not return any table. is there another way.the tables only have two columns , the email(different values)
    and authour (which is the same person in the table)
    when i tried 
    select * from TABLE A
    INNER JOIN TABLE B
    ON TABLEA. EMAIL = TABLEB.EMAIL
    INNER JOIN TABLEC
    ON TABLEA.EMAIL=TABLEC.EMAIL
    it came back with no result, the other way I am thinking is to unioun all all the tables and try to use count and group by ,but this will only show me the duplicates and not the authours
    please any other way

    it came back with no result, the other way I am thinking is to unioun all all the tables and try to use count and group by (but I could not insert my result in a new table)
    please any other way
    I dont understand your point here...Are you trying the below?
    Create Table T1(name varchar(50),Email Varchar(50))
    Insert into T1 Values('SQL','[email protected]'),('.NET','[email protected]')
    Create Table T2(name varchar(50),Email Varchar(50))
    Insert into T2 Values('Server','[email protected]'),('BizTalk','[email protected]')
    Create Table T3(name varchar(50),Email Varchar(50))
    Insert into T2 Values('Sql','[email protected]'),('server','[email protected]')
    ;With cte as
    (Select * From T1
    Union All
    Select * From T2
    Union All
    Select * From T3)
    Select name,email, count(1) From cte Group by name , email having count(1)>1
    Drop table T1,T2,T3
    I was able to insert the union product in a table, and i used this 
    SELECT EMAIL,AUTHOR,COUNT(EMAIL) AS AMOUNT FROM ALLEMAIL
     GROUP BY AUTHOR,EMAIL
     ORDER BY  AMOUNT DESC, email desc
    but its showing the email and the count but its appearing like the duplicate is only associated with one authour

  • Hide duplicate row and analytic functions

    Hi all,
    I have to count how many customers have two particular product on the same area.
    Table cols are:
    AREA
    PRODUCT_CODE (PK)
    CUSTOMER_ID (PK)
    QTA
    The query is:
    select distinct area, count(customer_id) over(PARTITION BY area)
    from all_products
    where product_code in ('BC01007', 'BC01004')
    group by area, customer_id
    having ( sum(decode(FPP.PRODOTTO_CODE,'BC01007',qta,0)) ) > 0)
    and ( sum(decode(FPP.PRODOTTO_CODE,'BC01004',qta,0)) ) > 0);
    In SQL*PLUS works fine, but in Oracle Discoverer I can't get distinct results also if I chek "Hide duplicate rows" in Table Layout .
    Anybody have another way to get distinct results for analytic function results?
    Thanks in advance,
    Giuseppe

    The query in Disco is exactly that I've post before.
    Results are there:
    AREA.........................................C1
    01704 - AREA VR NORD..............3
    01704 - AREA VR NORD..............3
    01704 - AREA VR NORD..............3
    01705 - AREA VR SUD.................1
    02702 - AREA EMILIA NORD........1
    If I check "hide duplicate row" in layout option results didn't change.
    If I add distinct clause manually in SQL*PLUS the query become:
    SELECT distinct o141151.AREA as E141152,COUNT(o141151.CUSTOMER_ID) OVER(PARTITION BY o141151.AREA ) as C_1
    FROM BPN.ALL_PRODUCTS o141151
    WHERE (o141151.PRODUCT_CODE IN ('BC01006','BC01007','BC01004'))
    GROUP BY o141151.AREA,o141151.CUSTOMER_ID
    HAVING (( SUM(DECODE(o141151.PRODUCT_CODE,'BC01006',1,0)) ) > 0 AND ( SUM(DECODE(o141151.PRODUCT_CODE,'BC01004',1,0)) ) > 0)
    and the results are not duplicate.
    AREA.........................................C1
    01704 - AREA VR NORD..............3
    01705 - AREA VR SUD.................1
    02702 - AREA EMILIA NORD........1
    There is any other way to force distinct clause in Discoverer?
    Thank you
    Giuseppe

  • Re: Update Duplicate Rows

    Oracle 11.2.0.2
    Windows 2008
    I have this table (case_file) with duplicate rows (case_number).
    I will like to make the case_number unique through out the table.
    For example, if I have two rows with the same case_number(225), I will like to change one of the numbers and record that case_number to the privious_case_number column.
    I am looking for a way to write up a script to automate the process.
    Any help will be appreciated.
    CREATE sequence case_id_seq
    start with 25;
    create table case_file
    ( case_id number not null, case_number varchar2(25), privious_case_number varchar(25), modified_by varchar2(50));
    INSERT into case_file (case_id, case_number, privious_case_number, modified_by)
    VALUES (case_id_seq.nextval, '220', '2002', 'DBA');
    INSERT into case_file (case_id, case_number, privious_case_number, modified_by)
    VALUES (case_id_seq.nextval, '225', null, 'DBA');
    INSERT into case_file (case_id, case_number, privious_case_number, modified_by)
    VALUES (case_id_seq.nextval, '224', null, 'PM');
    INSERT into case_file (case_id, case_number, privious_case_number, modified_by)
    VALUES (case_id_seq.nextval, '205', null, 'Supervisor');
    INSERT into case_file (case_id, case_number, privious_case_number, modified_by)
    VALUES (case_id_seq.nextval, '225', null, 'DBA');When I run the below query, I get this result, with 225 showing up twice:
    select * from case_file;
    26     225     2002     DBA
    27     220     2002     DBA
    28     225          DBA
    29     224          PM
    30     205          Supervisor
    31     225          DBAWhen I run the below script:
    SELECT case_number, COUNT(case_number) as Number_Of_Case_Number
    FROM case_file
    GROUP BY case_number
    HAVING COUNT(case_number) > 1I get this result
    CASE_NUMBER NUMBER_OF_CASE_NUMBER
    225 3
    SQL>Edited by: 868332 on Feb 6, 2012 1:23 PM

    Hi,
    Do you really need two unique numbers for each row?
    To make case_numebr unique, first, see what the highest existing case_number is, and create a new sequence that starts after that point:
    CREATE SEQUENCE     case_number_seq
    START WITH     250;Always use that sequence when assigning case_numbers in the future.
    To re-number the existing duplicates :
    UPDATE     case_file
    SET     case_number          = case_number_seq.NEXTVAL
    ,     previous_case_number     = case_number
    WHERE     case_id         IN (
                         WITH  got_r_num     AS
                          SELECT  case_id
                          ,       ROW_NUMBER () OVER ( PARTITION BY  case_number
                                                              ORDER BY         case_id
                                         )  AS r_num
                          FROM    case_file
                      SELECT  case_id
                      FROM        got_r_num
                      WHERE   r_num     > 1
    ;The sub-query got_r_num assigns numbers 1, 2, 3, ... to all rows, in order by case_id (lowest case_id gets r_num=1) with a separate set of numebrs for each case_number. When there are duplicates, one of the rows with that case_number will keep that case_number, and all the others will be new case_numebrs from case_numebr_seq.
    Edited by: Frank Kulash on Feb 6, 2012 4:37 PM
    Originally missed the part about previous_case_number. (Be careful how to spell "previous".)

  • Using JHS 'Duplicate Row' Feature In Form

    I am having a minor set back in implementing the JHeadstart duplicateRow() method in a Form (opposed to the default Table-view).
    In table-view the duplicateRow() method of the JhsCollectionModel works flawlessly with items that are set to Update Allowed?: while_new. When we use the method in a Form view however, items remain non-updateable after the Duplicate Row button has be pressed. This prevent rows from being copied within the given Form view page.
    I do not understand how this is occuring since row.setNewRowState(Row.STATUS_NEW) is being called within the duplicateRow() method. Is another object (other than oracle.jbo.Row) that needs to be used in Form view instead of Table view in order to perform this functionality?
    Thanks

    Well, after an entire day of playing around, I was finally able to get a proper call to the onCreate() method. I figure out that I could make a hard-coded call to:
    oracle.binding.OperationBinding opBinding = getBindings().getOperationBinding("CreateCampus"); ...to get a OperationBinding interface to a FacesCtrlActionBinding (which extends JUCtrlActionBinding). With a simple cast, this allowed me to make a call to JhsPageLifecycle.onCreate().
    Unfortunately, when the rest of my algorithm runs, it's not "copying" over any of the non-PK row values (as it normally does before I implemented this logic).
    So to simplify things: Has anyone ever coded a simple single-row copying ADF Faces/ADF BC feature before that would work in both Table and Form views? Or, how easily could the JHeadstart duplicateRow() feature be extended to work in Form-view?
    If I can see how a simple shallow copy is supposed to operate within the use of JHeadstart, I think I can extend it for our "deep copying' requirement.
    Thanks.

  • Advanced Table Duplicate Rows

    I have an advancedTable (master-detail). In one instance the "advancedTable" object suppresses duplicate master records, but in another instance, duplicate rows are not suppressed. If I run the VO query associated with the advancedTable object, the query returns duplicate rows in both instances. Has anyone seen this before? I have also run the pages from JDev connecting to each instance and the same result is exhibited.
    Thanks,
    LC

    -- application release 11.5.10.2 (both environments)
    -- database version 10.2.0.3 (stage) and 11.1.0.7 (dev)
    -- OS - RHEL 5 (both evironments)
    Both instances are not identical. The stage environment is RAC vs. dev which is not RAC.
    Steps to reproduce:
    Create an advancedTable in an advancedTable in JDev using a viewLink to establish the master-detail relationship. Run the page either from JDev connecting to each dev and stage environment directly. In addition to running local, I have also migrated all source to both the dev and stage instance. Run the page - in the dev instance, the results table displays only a subset of the rows (duplicate rows are removed - ie instead of 12 rows which is what the query returns both from executing the select statement in SQLPlus and by SOP vo.getRowCount() only 6 rows are displayed in the master table). However, when the same page is executed using the stage environment, all applicable rows are displayed - duplicates are not removed. This happens both from running the page locally and from logging into each respective application server.
    Thanks,
    LC

Maybe you are looking for

  • Problem On Sun Netra 210 Network

    Hi All, Why does my sun netra 210 cannot passed the network packet over HP Procurve 3500yl Core Switch? But, no problem occured when i use Cisco Catalyst Core Switch. Is there any incompability between Sun and Hp Procurve, or i need to install new pa

  • Group By In PLD

    HI all, Can we use Group by clause in PLD. IF yes how to use group by.. Thanks, Neetu

  • Installation of Elements 10 on MacBook Pro

    I have attempted to download my recently purchased Photoshop Elements 10 on my MacBook Pro. The applications appear to be present on the system but organizer will not start - initializing box appears then I get dialogue box, "Adobe Elements 10 Organi

  • Hardware Key

    i want repair the os windows 2003 server, harware key is changed

  • Firefox closes after being left idle. I uninstalled it, reinstalled it, and updated it and it still does it.

    My Firefox closes automatically after being left idle and it's annoying. I uninstalled it, downloaded it again, reinstalled it and updated it and it still does it. What could be the problem?