Remove duplicates from the result set

Here's a challenge question that I was playing with a my free time during the work.

I assume you have the basic HR example somewhere around (I hope is not in production).

Let's say you want to get employees from the employees table whose name is similar to another employee last name.
The easiest way is to join the two tables with a join condition that checks for the name and employee id. Here's what I came with.

*************

Select e1.last_name, e1.first_name b, e2.last_name c, e2.first_name d
employees employees join e1 e2
on (e1.last_name = e2.employee_id <>e2.last_name and e1.employee_id)
order by one;

************

The above query returns 10 rows. The first and the second are essentially the same. It is similarly, 3 & 4, 5 & 6, 7 and 8 and 9 and 10. The question is: is there a way that allows me to get rid of using only sql duplicate rows from the result set of this query. I sat on it for 15 minutes and I couldn't know. I'll try to watch my completed work once again.

Example:

SQL> column a format a10
SQL> column b format a10
SQL> column c format a10
SQL> column d format a10
SQL>
SQL>
SQL> select e1.last_name a , e1.first_name b, e2.last_name c, e2.first_name d
  2  from employees e1 join employees e2
  3  on ( e1.last_name = e2.last_name and e1.employee_id != e2.employee_id)
  4  where e1.employee_id < e2.employee_id
  5  order by a;

A          B          C          D
---------- ---------- ---------- ----------
Cambrault  Gerald     Cambrault  Nanette
Grant      Kimberely  Grant      Douglas
King       Steven     King       Janette
Smith      Lindsey    Smith      William
Taylor     Jonathon   Taylor     Winston

SQL>

Tags: Database

Similar Questions

  • Remove duplicates from the oracle table using 2 columns

    Hello

    I need to remove the duplicates of an oracle table based on 2 columns in the table.i tried to remove duplicates using the join, but get the error like sql error ora-00933

    Thank you

    Hello

    Here's one way:

    DELETE FROM table_x

    WHERE ROWID NOT IN)

    SELECT MIN (ROWID)

    FROM table_x

    Col_1, col_2

    );

    I hope that answers your question.

    If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.

    In the case of a DML operation (for example, REMOVE) the sample data should show what look like the paintings before the DML, and results will be the content of the or the tables changed after the DML.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

  • Help with the query to select only one record from the result set in double

    Hello

    Please help with the query. Version of Oracle database we use is 10g R2.

    I have a vision that is duplicated IDS, but they are used across the different functions. See below examples of data. Please help me with a query to select only one record (based on ID regardless of the area) from the bottom of the result set of duplicate records. For what is the point of view is there unique records, given the combination of the fields ID, Org, DF, dry, Sub-Sec

    ID
    Org
    DF
    Sec Sub-Sec

    (163)CQCPDMCPDMHD(163)PCENGENGENG(163)CQASICASICIS8888TSTACTACTAC(163)TSHEHESW6789CQINFOINFOFOS6789PCSECSYSSECSYSINFO16789TSSECSYSSECSYSINFO29009PCBMSBMSBMS1

    My result set must eliminate the duplicate identifiers regardless of whoever we choose of the result set. (I mean without distinction Org, DF, s, Sub-s). My expected result set should be.

    ID
    DSB

    DF
    SEC
    Sub-Sec
    (163)CQCPDMCPDMHD8888TSTACTACTAC6789CQINFOINFOFOS9009PCBMSBMSBMS1


    Thank you

    Orton

    Hello

    This sounds like a job for ROW_NUMBER:

    WITH got_r_num AS

    (

    SELECT id, DSB, df, s, sub_sec org

    ROW_NUMBER () OVER (PARTITION BY ID.

    ORDER BY org

    ) AS r_num

    OF view_x

    )

    SELECT id, DSB, df, sub_sec s,

    OF got_r_num

    WHERE r_num = 1

    ;

    He is a Top - N query example, where you choose the elements of N (N = 1 in this case) from the top of an ordered list.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and INSERT, only relevant columns instructions) to your sample data and the results desired from these data.  (I know that you said that you were a view selection.  Just for this thread, pretending it is a picture and post simple CREATE TABLE and INSERT statements to simulate your point of view).
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.  (I didn't quite understand the explanation above.  I don't know why you want to

    ID ORG DF DRY SUB_SEC

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

    1234 CQ DPRK DPRK HD

    and is not

    1234 IS CQ ASIC, ASIC

    or

    TS 1234 IT IT SW

    or

    1234 CQ ASIC ASIC HD

    )
    If you change the query at all, post your modified version.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • How to remove duplicates from the PL - SQL table?

    Hi gurus,

    I have a PL - SQL table with the following structure
    Authors (SR_NO, Auth_Code, Change_Date, cost)

    This table is filled using a slider. However, this table can have a few lines in double (for column (Auth_Code)
    for example
    SR_NO      Auth_Code       Change_Date                       Cost
    1               A1             14-FEB-09 08.18.47 AM          11.00
    2               A2             14-FEB-09 08.18.56 AM       2839.00
    3               A1             15-FEB-09 08.00.02 AM      1299.00
    4               A1             15-FEB-09 07.00.00 AM        789.00
    5               A3             14-FEB-09 08.18.56 AM        312.00
    6               A4             14-FEB-09 08.19.02 AM        233.00
    I need to get the above result set select the separate lines of Auth_Code including the Change_Date is maximum (and store in another PL - SQL table for treatment later or even the removal of this table will be also!)

    of the data A1 is duplicated and a maximum Change_Date above = 15 February 09 08.00.02 AM.
    Where my PL - SQL Table that results must have given below
    SR_NO      Auth_Code       Change_Date                       Cost
    2               A2             14-FEB-09 08.18.56 AM       2839.00
    3               A1             15-FEB-09 08.00.02 AM      1299.00
    5               A3             14-FEB-09 08.18.56 AM        312.00
    6               A4             14-FEB-09 08.19.02 AM        233.00
    I'm not very aware of the PL - SQL tables and there is no chance to change the existing cursor that fills the data in this table PL - SQL.
    I guess that I need to compare each record of PL - SQL table with others, but do not know how to do this.

    Could you please help?

    Hello

    Like this?:

    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    
    SQL>
    SQL> with data as(
      2  select 1 as SR_NO, 'A1' as Auth_Code, to_date('14-FEB-09 08.18.47', 'dd-mon-yy hh24:mi:ss') as change_date,    11.00 as cost from dual union all
      3  select 2 as SR_NO, 'A2' as Auth_Code, to_date('14-FEB-09 08.18.56', 'dd-mon-yy hh24:mi:ss') as change_date,  2839.00 as cost from dual union all
      4  select 3 as SR_NO, 'A1' as Auth_Code, to_date('15-FEB-09 08.00.02', 'dd-mon-yy hh24:mi:ss') as change_date,  1299.00 as cost from dual union all
      5  select 4 as SR_NO, 'A1' as Auth_Code, to_date('15-FEB-09 07.00.00', 'dd-mon-yy hh24:mi:ss') as change_date,   789.00 as cost from dual union all
      6  select 5 as SR_NO, 'A3' as Auth_Code, to_date('14-FEB-09 08.18.56', 'dd-mon-yy hh24:mi:ss') as change_date,   312.00 as cost from dual union all
      7  select 6 as SR_NO, 'A4' as Auth_Code, to_date('14-FEB-09 08.19.02', 'dd-mon-yy hh24:mi:ss') as change_date,   233.00 as cost from dual)
      8  select * from data d where change_date = (select max(change_date) from data d2 where d.auth_code = d2.auth_code);
    
         SR_NO AUTH_CODE CHANGE_DATE       COST
    ---------- --------- ----------- ----------
             2 A2        14/02/2009        2839
             3 A1        15/02/2009        1299
             5 A3        14/02/2009         312
             6 A4        14/02/2009         233
    
    SQL>
    

    Kind regards

  • AF:inputListOfValues sets the value of the first item in the result set when using enter key or tab and component value autosubmit = true

    I use JDev 11.1.1.6 and when I type in a value in an af:inputListOfValues element and press enter or the tab key, it will replace the value I entered with the first element in the set of results LOV. If enter a value, simply click on the component af:inputListOfValues it works correctly. If I use the popup and find a value it works properly as well. I have a programmatic view object that contains a single transitional attribute (this is the view object that is used to create the list of the components of the value of) and then I have another object from view based on entities which defines one of its attributes in a list of the attribute value. I tried to use a base object view of entity to create the LOV to and everything works as expected, so I don't know if this is a bug when using programmatic view objects or if I need more code in the VOImpl. In addition, it seems after that first of the value being replaced by the first value in the result set that it will work correctly as well. Here are some excerpts of important code.

    Also, it seems that this does not work only if the text entered in the component af:inputListOfValues would have only a single game, returned in the result set. For example, given the result defined in code: Brad, Adam, Aaron, Fred, Charles, Charlie, Jimmy

    If we get into Cha, the component works as expected

    If we register A, the component works as expected

    If we get Jimmy, the component does not work as expected, and returns the first value of results IE. Brad

    If we get Fred, the component does not work as expected, and returns the first value of results IE. Brad

    I also checked that I get the same behavior in JDev 11.1.1.7

    UsersVOImpl (programmatic view with 1 transitional attribute object)

    import java.sql.ResultSet;
    
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.List;
    
    import oracle.adf.share.logging.ADFLogger;
    
    import oracle.jbo.JboException;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    
    // ---------------------------------------------------------------------
    // ---    File generated by Oracle ADF Business Components Design Time.
    // ---    Wed Sep 18 15:59:44 CDT 2013
    // ---    Custom code may be added to this class.
    // ---    Warning: Do not modify method signatures of generated methods.
    // ---------------------------------------------------------------------
    
    public class UsersVOImpl extends ViewObjectImpl {
    
        private static ADFLogger LOGGER = ADFLogger.createADFLogger(UsersVOImpl.class);
        private long hitCount = 0;
    
        /**
         * This is the default constructor (do not remove).
         */
        public UsersVOImpl () {
        }
    
        /**
         * executeQueryForCollection - overridden for custom java data source support.
         */
        protected void executeQueryForCollection (Object qc, Object[] params, int noUserParams) {
    
             List<String> usersList = new ArrayList<String>();
             usersList.add("Brad");
             usersList.add("Adam");
             usersList.add("Aaron");
             usersList.add("Fred");
             usersList.add("Charles");
             usersList.add("Charlie");
             usersList.add("Jimmy");
    
             Iterator usersIterator = usersList.iterator();
             setUserDataForCollection(qc, usersIterator);
             hitCount = usersList.size();
             super.executeQueryForCollection(qc, params, noUserParams);
    
        } // end executeQueryForCollection
    
        /**
         * hasNextForCollection - overridden for custom java data source support.
         */
        protected boolean hasNextForCollection (Object qc) {
    
             Iterator usersListIterator = (Iterator)getUserDataForCollection(qc);
             if (usersListIterator.hasNext()) {
         
                 return true;
    
             } else {
    
                 setFetchCompleteForCollection(qc, true);
                 return false;
    
             } // end if
    
        } // end hasNextForCollection
    
        /**
         * createRowFromResultSet - overridden for custom java data source support.
         */
        protected ViewRowImpl createRowFromResultSet (Object qc, ResultSet resultSet) {
    
             Iterator usersListIterator = (Iterator)getUserDataForCollection(qc);
             String user = (String)usersListIterator.next();
             ViewRowImpl viewRowImpl = createNewRowForCollection(qc);
    
             try {
    
                 populateAttributeForRow(viewRowImpl, 0, user.toString());
    
             } catch (Exception e) {
    
                 LOGGER.severe("Error Initializing Data", e);
                 throw new JboException(e);
    
             } // end try/catch
    
             return viewRowImpl;
    
        } // end createRowFromResultSet
    
        /**
         * getQueryHitCount - overridden for custom java data source support.
         */
        public long getQueryHitCount (ViewRowSetImpl viewRowSet) {
             return hitCount;
        } // end getQueryHitCount
    
        @Override
        protected void create () {
    
             getViewDef().setQuery(null);
             getViewDef().setSelectClause(null);
             setQuery(null);
    
        } // end create
    
        @Override
        protected void releaseUserDataForCollection (Object qc, Object rs) {
    
             Iterator usersListIterator = (Iterator)getUserDataForCollection(qc);
             usersListIterator = null;
             super.releaseUserDataForCollection(qc, rs);
    
        } // end releaseUserDataForCollection
    
    } // end class
    
    

    <af:inputListOfValues id="userName" popupTitle="Search and Select: #{bindings.UserName.hints.label}" value="#{bindings.UserName.inputValue}"
                                                  label="#{bindings.UserName.hints.label}" model="#{bindings.UserName.listOfValuesModel}" required="#{bindings.UserName.hints.mandatory}"
                                                  columns="#{bindings.UserName.hints.displayWidth}" shortDesc="#{bindings.UserName.hints.tooltip}" autoSubmit="true"
                                                  searchDesc="#{bindings.UserName.hints.tooltip}"                                           
                                                  simple="true">
                              <f:validator binding="#{bindings.UserName.validator}"/>                       
    </af:inputListOfValues>
    
    
    
    

    I found a solution to this problem. It seems that, when using a view object programmatic that has a transient as its primary key attribute, you need to override the methods in the ViewObjectImpl so that he knows how to locate the line related to the primary key when the view object records are not in the cache. That's why it would work properly sometimes, but not always. Here are the additional methods that you must override. The logic you use in the retrieveByKey would be on a view view object database object and would be different if you had a primary key consisting of multiple attributes.

    @Override
    protected Row[] retrieveByKey (ViewRowSetImpl viewRowSetImpl, Key key, int i) {
        return retrieveByKey(viewRowSetImpl, null, key, i, false);
    }
    
    @Override
    protected Row[] retrieveByKey (ViewRowSetImpl viewRowSetImpl, String string, Key key, int i, boolean b) {
    
        RowSetIterator usersRowSetIterator = this.createRowSet(null);
        Row[] userRows = usersRowSetIterator.getFilteredRows("UserId", key.getAttribute(this.getAttributeIndexOf("UserId")));
        usersRowSetIterator.closeRowSetIterator();
        return userRows;
    
    }
    
    @Override
    protected Row[] retrieveByKey (ViewRowSetImpl viewRowSetImpl, Key key, int i, boolean b) {
        return retrieveByKey(viewRowSetImpl, null, key, i, b);
    }
    
  • My iPhone and Mac all have two Photos related to iCloud, same images appear on both. How to remove pictures from the phone without removing them from the Mac

    I've shared pictures between my Mac and iPhone using iCloud. Recently downloaded about 1800 brother SmugMug account family photos. Subsequently discovered that they had all been loaded on my phone as well. When I try to delete them from my phone, I get a message the suggests that if I do, the photos will be removed from my Mac was fine. How can I remove the phone and let the Mac intact?

    I've shared pictures between my Mac and iPhone using iCloud.

    What iCloudService do you use?

    • If the iPhone and the Mac are synchronized with iCloud photo library, removal of the photos from the iPhone will remove them from the Mac as well.  iCloud photo library is a synchronization service that will ensure that you see the same pictures on all devices. All change at will the timing and any deletion or any import.  To win the storage on the iPhone allow the iCloud Photos setting "Optimize Storage.
    • If photos have been synced with my photos and not iCloud library stream, you can remove them from the iPhone. They must stay in the library on your Mac. But before a massive deletion on any device, make a backup of your photo library, just to be sure.
  • Item number: 314481 how to manually remove programs from the add tool / remove program does not work! What's next?

    Tried to uninstall a program using the Add / Remove program.  The tool has requested a copy of 'Install the CD' I did not.  Then I tried to uninstall the program by following the instructions in the Article ID: 314481 how to manually remove programs from the add tool / remove program.  It didn't not t work!  The name of the program calmed listed in the tool of installed programs list even if the "Delete" button is no longer visible.   The registry key and its subkeys appear to have been deleted but still the program name in the list of installed programs tool.  WHAT IS PLANNED?

    Some people have good results with the free copy of Revo Uninstaller that you can get from here:

    http://www.revouninstaller.com/index.html

  • Cannot remove messages from the Inbox

    I'm unable to remove items from the Inbox

    You did not mention what e-mail program you use. These instructions will help you with Outlook Express.

    Spend most of your messages out of the Inbox if you can and move the messages you want to record off deleted items, and sent items. Locate the OE message store and then close OE.

    Tools | Options | Maintenance | Store folder will reveal the location of your Outlook Express files. Note the location and navigate on it in Explorer Windows or, copy and paste in start | Run.

    In Windows XP, Win2K & Win2K3 the OE user files (DBX and WAB) are by default marked as hidden. To view these files in Windows Explorer, you must enable Show hidden files and folders under start | Control Panel | Folder Options icon | Opinion, or in Windows Explorer. Tools | Folder options | View.

    With OE closed, find the Deleted Items.dbx and Sent Items.dbx files and delete them. New files will be created automatically when you open OE.

    Compact all folders as described below.

    To avoid this in the future:

    Do not archive mail in the receipt or sent items box. Create your own user-defined folders and move messages you want to put in them. Empty the deleted items folder daily. Although the dbx files have a theoretical capacity of 2 GB, I recommend all a 300 MB max for less risk of corruption.

    Information on the maximum size of the .dbx files that are used by Outlook Express:
    http://support.Microsoft.com/?kbid=903095

    After you're done, followed by compacting your folders manually while working * off * and do it often.

    Click Outlook Express at the top of the the folder tree so no folders are open. Then: File | Work offline (or double-click on work online in the status bar). File | Folder | Compact all folders. Don't touch anything until the compacting is completed.

    Disable analysis in your e-mail anti-virus program. It is a redundant layer of protection that devours the processors and causes a multitude of problems such as time-outs and account setting changes. Your up-to-date A / V program will continue to protect you sufficiently. For more information, see:
    http://www.oehelp.com/OETips.aspx#3

    Bruce Hagen
    MS - MVP October 1, 2004 ~ September 30, 2010
    Imperial Beach, CA

  • It is usually safe to remove items from the user / local/temp file? I want to free up space.

    Original title: local/temp folder files

    It is usually safe to remove items from the user / local/temp file?  I want to free up space.

    Clean the system (compensation to all temp/tmp folders and included all the content offline, the tif browser, delete the cookies of compensation.)

    Do a disk cleanup. Click the Start button. in the search box, type Disk Cleanup, and then in the list of results, click Disk Cleanup.

    Delete your temp files where a large number of software malware installers cache and or CCleaner for a more thorough cleaning.

    Download the basic version (slim) via

    http://www.CCleaner.com/download/builds.aspx>

    The basic version (slim) does not contain the toolbar disgusted

    Cleaning DO NOT USE ANY Advanced options. DO NOT TOUCH THE REGISTRY OR TOOLS. At least not for now.
    Reset

    UTC/GMT is 04:20 on Thursday, January 5, 2012

  • Windows Live Movie Maker 2011 - how to remove items from the recent projects list

    Windows Live Movie Maker 2011

    I have duplicates on my list of recent projects.

    How to remove items from the numbered list of recent projects?  What are the (thumb)

    bugs used for?  Thank you.

    Hello

    The question you have posted is related to Windows Live Movie Maker and would be better suited in the Windows Live Solution Center. Please visit the link below to find a community that will provide the best support.

    http://www.windowslivehelp.com/product.aspx?ProductID=5

    Amrita M

    Microsoft Answers Support Engineer

  • Remove duplicates of the chain

    Hello

    I need help to remove duplicates from a string that contains years and ' - '. Example: 1988-1997-2000-2013-1998-1965-1997-1899

    I know it can be done in regular expressions, but have no experience in this area.

    Select REGEXP_REPLACE (...) of double;

    Thank you

    SQL >-example of production line

    SQL > with t (select ' 1988-1997-2000-2013-1998-1965-1997-1899' double Str)

    2  --

    3 - actual query:

    4  --

    5 Select listagg (str, '-') within the Group (order by null)

    6 from select (separate str

    7 in (select regexp_substr (str, ' [^-] +', 1, rn) str)

    8 t

    9 cross join (select rownum rn

    10 in (select max (length (regexp_replace (str, ' [^-] +'))) + 1 mx)

    11                                    from   t

    12                                  )

    13 connect by level<=>

    14                           )

    15 where regexp_substr (str, ' [^-] +', 1, rn) is not null

    16              )

    17       );

    LISTAGG(STR,'-') WITHINGROUP (ORDERBYNULL)

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

    1899-1965-1988-1997-1998-2000-2013

    1 selected line.

  • Combine queries to get the result set with max Y

    Hello
    I use forms 6i and db 10.2.0.1.0

    With the query below
    Select ufam_usrgrp,ufam_filegrp,ufam_read,ufam_write,ufam_overwrite,ufam_delete from usr_file_access_master
    Where ufam_ecode = '0004108';
    the result set is
    UFAM_USRGRP     UFAM_FILEGRP    UFA UFA UFA UFA
    --------------- --------------- --- --- --- ---
    MGMNT           CV              Y   Y   Y   Y
    EMPLOYEE        GENERAL         Y   N   N   N
    EMPLOYEE        PERSONAL        Y   N   N   N
    Another query
    Select uul_usrgrp, ufl_file_grp,ufl_read,ufl_write,ufl_overwrite,ufl_delete from usr_usrgrp_lnk,USRGRP_FILEGRP_LINK
    Where usr_usrgrp_lnk.uul_usrgrp = USRGRP_FILEGRP_LINK.UFL_USR_GRP
    and usr_usrgrp_lnk.uul_ecode = '0004108'
    gives the result
    UUL_USRGRP      UFL_FILE_GRP    UFL UFL UFL UFL
    --------------- --------------- --- --- --- ---
    MGMNT           GENERAL         Y   Y   Y   Y
    EMPLOYEE        GENERAL         Y   Y   N   N
    MGMNT           CV              Y   N   N   N
    I need to combine these two queries to get a separate result set with maximum Y

    Like here "MGMNT CV" is repeated in both the result set, but the first has more, then it should come from the combined result set. reverse-case also the same (such as "EMPLOYEE GENERAL")

    So I want to combine the queries so that I get the result as set below
    UserGroup       FileGroup       Rd Wrt Owrt Del
    --------------- --------------- --- --- --- ---
    MGMNT           GENERAL         Y   Y   Y   Y
    EMPLOYEE        GENERAL         Y   Y   N   N
    MGMNT           CV              Y   Y   Y   Y
    EMPLOYEE        PERSONAL        Y   N   N   N
    Please help me to combine these queries

    Published by: Divya on August 14, 2011 21:24
    Changed the result set and the last exit

    NOT TESTED!

    select y.uul_usrgrp,
           y.ufl_file_grp,
           greatest(ufl_read,nvl(ufam_read,' ')) ufl_read,
           greatest(ufl_write,nvl(ufam_write,' ')) ufl_write,
           greatest(ufl_overwrite,nvl(ufam_overwrite,' ')) ufl_overwrite,
           greatest(ufl_delete,nvl(ufam_delete,' ')) ufl_delete
      from (select ufam_usrgrp,ufam_filegrp,ufam_read,ufam_write,ufam_overwrite,ufam_delete
              from usr_file_access_master
             Where ufam_ecode = '0004108'
           ) x,
           (select uul_usrgrp, ufl_file_grp,ufl_read,ufl_write,ufl_overwrite,ufl_delete
              from usr_usrgrp_lnk,USRGRP_FILEGRP_LINK
             Where usr_usrgrp_lnk.uul_usrgrp = USRGRP_FILEGRP_LINK.UFL_USR_GRP
               and usr_usrgrp_lnk.uul_ecode = '0004108'
           ) y
     where y.uul_usrgrp = x.ufam_usrgrp(+)
       and y.ufl_file_grp = x.ufam_filegrp(+)
    

    Concerning

    Etbin

    Edited by: Etbin on 14.8.2011 13:08
    deleted by group

  • How to exclude the each row of the result set XML declaration?

    Hello

    I have a table with an XMLTYPE column and would like to SELECT a set of rows. How can I exclude the each row of the result set XML declaration? My query currently looks like this, I am running through Spring JDBC:
    SELECT XMLSerialize FROM t1 WHERE XMLEXISTS('$e/Event' PASSING XMLTEXT AS "e") ORDER BY t1.time DESC myschema.event (HAPPY t1.xmltext)

    After selecting, in my application I convert each line in a string and concatenate all the rows in a large chain to analyze in a DOM model. I get a parser exception (org.xml.sax.SAXParseException: the target of the processing instruction corresponding to "[xX] [mM] [he's]" is not allowed) because there are several XML statements in my large chain. Of course, I could manually check the string on each line if it starts with the XML declaration, but it would be nicer if I could load the DB does not add it in the first place. Is there a way?

    Thank you!
    -Daniela

    Hello

    Some options that I can think of:

    SELECT XMLSerialize(CONTENT
     XMLtransform(t1.xmltext,
      xmltype('
     
     
    ')
     )
    )
    FROM myschema.event t1
    WHERE XMLEXISTS('$e/Event' PASSING XMLTEXT AS "e")
    ORDER BY t1.time DESC
    ;
    

    or quite simply,.

    SELECT XMLSerialize(CONTENT
      extract(t1.xmltext,'/')
    )
    FROM myschema.event t1
    WHERE XMLEXISTS('$e/Event' PASSING XMLTEXT AS "e")
    ORDER BY t1.time DESC
    ;
    
  • How to test a procedure returns the result set

    Hello

    I have a following code:

    {color: #0000ff} create or replace the TYPES of PACKAGING
    AS
    type cursorType is ref cursor;
    end;

    create or replace PROCEDURE GetAllCategories (p_cursor in the Types.cursorType)
    AS
    Start
    Open p_cursor for SELECT * CATEGORY;
    end; {color}

    I would like to test the procedure of * {color: #000000} visualization output resultset {color} *. How can I do with SQL Developer?
    In fact, when select RUN in SQL Developer, I got the following code:

    DECLARE
    P_CURSOR types.cursorType;
    BEGIN

    GetAllCategories (P_CURSOR = & gt; P_CURSOR);
    END;

    When I run it, it is successful but there is no result set displayed. However if I execute SELECT * FROM category only in the SQL Editor, I see the result set in the grid. Then where the result set did when he went through the procedure?

    Thanks in advance for any help.

    Published by: CarbonFiber Sep 22, 2008 20:52

    Is a simple way with sqlplus

    SQL> create or replace package types
      2  as
      3     type cursortype is ref cursor;
      4  end;
      5  /
    
    Package created.
    
    SQL> create or replace procedure getallemp(p_cursor in out types.cursortype )
      2  as
      3  begin
      4     open p_cursor for select * from emp;
      5  end;
      6  /
    
    Procedure created.
    
    SQL> var lcursor refcursor
    SQL>
    SQL> exec getallemp(:lcursor)
    
    PL/SQL procedure successfully completed.
    
    SQL> print lcursor
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO        DIV
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- ----------
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20         10
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30         10
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20         10
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30         10
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30         10
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10         10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20         10
          7839 KING       PRESIDENT            17-NOV-81       5000                    10         10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30         10
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20         10
    
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO        DIV
    ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- ----------
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30         10
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20         10
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10         10
    
    14 rows selected.
    

    Thank you
    Knani.

  • Remove malware from the iPhone 6

    Hello

    I own an iPhone 6. I have whatsapp on it. Someone sent me a video through whatsapp and I clicked it. However, I fear that there might be malicious software that I do not trust the source who sent me the video and I opened it by mistake. Is there anyway to detect malicious software or remove it from the IPhone 6 without having to reset to factory settings? What is the best way to secure all my data and passwords on my phone? The software was not updated when the incident occurred. I have updated to the latest iOS a few days later.

    Also, I have an iPad that has the same applications and passwords for my iPhone. Is it possible that the malware would be transmitted to my iPad when I'm online? I also have a Mac book. Is my Apple ID even course or should I change it?

    Thank you in advance.

    the only way to get software (any software at all) in an ios device that has not been jailbroken is apples app store

    a mail software? NOP software downloaded from a web site? NOP software by a link? NOP

Maybe you are looking for

  • NEITHER Vision 2009 64-bit

    I want to check the NI Vision 2009 libraries run on Vista x 64 and LV 2009 as "native" 64-bit code and not WoW64. I need to process VERY large images.

  • How to set the dependency?

    Hi, I created two projects in the framework still a draft package is based on another medium he uses this project with the class. I am therefore unable to build the project.  In the samples under folder browser 'BrowserFieldDemo' and 'commonlib' of p

  • power off the computer event tracker

    Why you shut down your copmputer? A dialog window appears and must choose a tracker of event to turn my comp [add power off. So how can you stop intrusive measures of Microsoft. First time I've seen something like this. What is fustrating-it, it's my

  • I received a 800F0922 error code when I try to install Windows Update.

    No help for me looking for error 800F0922 Split from: http://answers.microsoft.com/en-us/windows/forum/windows_8-windows_update/i-receive-an-error-code-800f0922-when-i-try-to/1398e178-c421-40e5-ad03-e890cdf2cdf9

  • Problem with the connection from Oracle to MS Excel - 64 bit

    HelloI have problem connecting Excel to oracle 11.2 using DG4ODBC.OS - Windows 7 64 bitDatabase version: - Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64 bitCreated system using ODBC DSN:Name of Data Source = test12Oracle home path:-D