ExecuteQueryForObject returned too many results.

Hi,
My servlet accesses an Oracle db, it works fine most of the time except for when I search for one particular entry.
When I do this the following error message is displayed:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error: executeQueryForObject returned too many results.
     org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
     org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
     org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
     org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
     org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
root cause
java.sql.SQLException: Error: executeQueryForObject returned too many results.
     com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:108)
     com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:561)
     com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)
     com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:93)
     com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:70)
     com.bmw.urt3fms.cardata.ctrl.SearchCarAction.execute(Unknown Source)
     org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
     org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
     org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
     org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
This is really strange as all the other searches I have done all worked except this one.
Any ideas as to why it would display this??
Nick

Error executeQueryForObject returned too many results
Typical Error msg:
“SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; Error: executeQueryForObject returned too many results.; nested exception is java.sql.SQLException: Error: executeQueryForObject returned too many results”
The error is caused for using queryForObject (for a single result) instead of queryForList (when expecting multiple results).
Example of correct solution
In DAO:
public List<UpdatedContractRateDO> getUpdatedCtrctRate(Map paramMap) throws DataAccessException {
return (List<UpdatedContractRateDO>) getSqlMapClientTemplate().queryForList("charge.getUpdatedCtrctRate", paramMap);
}

Similar Messages

  • ExecuteQueryForObject returned too many results jdbc error

    Hi All,
    I am getting the following error on running the tomcat 6.0 and I have Oracle 11g installed.
    08 Dec 2010 16:23:41 ERROR [QUARTZ_Worker-5] org.quartz.core.JobRunShell - Job DCTM.DCTMServerPipe threw an unhandled Exception:
    org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; Error: executeQueryForObject returned too many results.; nested exception is java.sql.SQLException: Error: executeQueryForObject returned too many results.
         at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:121)
         at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
         at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:212)
         at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271)
         at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:265)
         at com.emc.documentum.bpm.daos.impl.AbstractIbatisBaseDaoImpl.queryForObject(AbstractIbatisBaseDaoImpl.java:119)
         at com.emc.documentum.bpm.bamengine.daos.impl.ServerConfigDaoImpl.getDBCurrentTime(ServerConfigDaoImpl.java:28)
         at com.emc.documentum.bpm.bamengine.services.server.factory.impl.ServersFactoryImpl.updatePipeServerTimezoneOffset(ServersFactoryImpl.java:56)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
         at $Proxy50.updatePipeServerTimezoneOffset(Unknown Source)
         at com.emc.documentum.bpm.bamengine.services.sharedservices.impl.TaskManagerServiceImpl.executePipe(TaskManagerServiceImpl.java:341)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:301)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198)
         at $Proxy52.executePipe(Unknown Source)
         at com.emc.documentum.bpm.bamengine.scheduler.impl.PipeJobImpl.execute(PipeJobImpl.java:17)
         at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
         at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
    Caused by: java.sql.SQLException: Error: executeQueryForObject returned too many results.
         at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:124)
         at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
         at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
         at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
         at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:273)
         at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:209)
         ... 23 more
    How can this be resolved? Please help !!
    Thanks, T
    Edited by: 805903 on Dec 9, 2010 3:00 AM

    Error executeQueryForObject returned too many results
    Typical Error msg:
    “SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; Error: executeQueryForObject returned too many results.; nested exception is java.sql.SQLException: Error: executeQueryForObject returned too many results”
    The error is caused for using queryForObject (for a single result) instead of queryForList (when expecting multiple results).
    Example of correct solution
    In DAO:
    public List<UpdatedContractRateDO> getUpdatedCtrctRate(Map paramMap) throws DataAccessException {
    return (List<UpdatedContractRateDO>) getSqlMapClientTemplate().queryForList("charge.getUpdatedCtrctRate", paramMap);
    }

  • JDO: Query returns too many results.

    Hello,
    I want to get some DO-Entities from an empty table. When I execute the query I retrieve more than 2 000 000 000 results what is definitly too much for an empty table. The DO has an one-to-many relationship to another class and a many-to-one relationship to another one.
    The .map and .jdo files of the class and the classes in relation made accordng to the explanations in the Development Manual chapter "Mapping Persistent Classes to Database Tables" (so including DFG- and embedded- attributes). Enhancing is successfull and the work with the classes that doesn't have relationships also.
    The query looks like this:
                   manager = getPersistenceFactory().getPersistenceManager();
                   String filter = "version == \"" + version + "\" && postingLevel == \"" + postingLevel +
                                       "\" && closingPeriod == " + closingPeriod + " && bunit== \"" + bunit + "\"";
                   Query query = manager.newQuery(AD_DO_Protocol.class, filter);
                   Collection col = (Collection) query.execute();
    I also tried to use the extent with the same result.
    Any ideas?
    Regards,
    Jan

    Hi Guru,
    first of all in that certain method of the DAO I'm not able to use the primary key because I implement a check if an entity with the given attributes allready exists.
    Second I don't want (and as I think don't have) to write the mentioned java function for the following reason: There must be max one result for the given query. Thats a constraint implied by our business logic.
    In fact at the given moment there must not be a single result because the table IS EMPTY!!!
    Any other ideas?
    Thx and regards,
    Jan

  • SQL Expression returning too many results

    I am trying to display the value of a field in one table as a caption in the report header. This  caption is above a u2018descriptionu2019 field in the details section. When I run my report, I get  the description field displaying 832 times; which is the number of rows found in my caption table. Here is the structure of the two tables:
    Table 1: Code, Description
    Table 2: Table, Name, Field Name, Caption
    Here are the SQL Expressions that I have tried:
    (SELECT Caption FROM Table2
        WHERE Table2.FieldName='Description'
              AND Table2.TableName='Code')
    (SELECT DISTINCT Caption FROM Table2
        WHERE Table2.FieldName='Description'
              AND Table2.TableName='Code')
    And
    (SELECT TOP 1 Caption FROM Table2
        WHERE Table2.FieldName='Description'
              AND Table2.TableName='Code')
    If I run these directly in my Db, I get correct results. If in Crystal, incorrect results. I have tried the following suppress on the Details: Table1.Code= previous (Table1.Code) which works UNLESS I have any summaries. Once I include a summary, my total ALWAYS factors in the suppressed, duplicate records.
    I have now moved to try using parameters and a sub report for each caption; however my existing reports have sub reports that also need caption changes and I am not aware of a way to add a subreport to a subreport
    Any ideas?

    can you use select distinct on all the queries,
    crystal tends to duplicate
    create a group for your distinct value
    place the records in the group header and it will return the first unique value it hits.

  • Query returns too many results

    I have this query that returns 118,900 records when I try to
    add
    or oth_tchname_ssn like '%123456789%'
    at the end of the query.
    When I remove the or oth_tchname_ssn like '%123456789%' it
    returns 32 records which seems about right.
    Any ideas as to where my cfquery statement is wrong?
    Thanks
    Emmanuel

    This was solved by adding parent tags.

  • Texts keep getting returned--too many digits error, pls help

    Hi, everyone!
    I upgraded to 4.3.3, yesterday so far no problems, except this morning my phone started to send me an error message every time I send a text and says "this message could not be sent, you've entered too many digits." How do I fix this? And the number it shows is an 11-digit number because it adds the 1...
    Does anyone know what I can do?

    Error executeQueryForObject returned too many results
    Typical Error msg:
    “SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; Error: executeQueryForObject returned too many results.; nested exception is java.sql.SQLException: Error: executeQueryForObject returned too many results”
    The error is caused for using queryForObject (for a single result) instead of queryForList (when expecting multiple results).
    Example of correct solution
    In DAO:
    public List<UpdatedContractRateDO> getUpdatedCtrctRate(Map paramMap) throws DataAccessException {
    return (List<UpdatedContractRateDO>) getSqlMapClientTemplate().queryForList("charge.getUpdatedCtrctRate", paramMap);
    }

  • Unable to create report. Query produced too many results

    Hi All,
    Does someone knows how to avoid the message "Unable to create report. Query produced too many results" in Grid Report Type in PerformancePoint 2010. When the mdx query returns large amount of data, this message appears. Is there a way to get all
    the large amount in the grid anyway?
    I have set the data Source query time-out under Central Administration - Manager Service applications - PerformancePoint Service Application - PerformancePoint Service Application Settings at 3600 seconds.
    Here Event Viewer log error at the server:
    1. An exception occurred while running a report.  The following details may help you to diagnose the problem:
    Error Message: Unable to create report. Query produced too many results.
            <br>
            <br>
            Contact the administrator for more details.
    Dashboard Name:
    Dashboard Item name:
    Report Location: {3592a959-7c50-0d1d-9185-361d2bd5428b}
    Request Duration: 6,220.93 ms
    User: INTRANET\spsdshadmin
    Parameters:
    Exception Message: Unable to create report. Query produced too many results.
    Inner Exception Message:
    Stack Trace:    at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportWithParameters(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer)
       at Microsoft.PerformancePoint.Analytics.ServerRendering.OLAPBase.OlapViewBaseControl.ExtractReportViewData()
       at Microsoft.PerformancePoint.Analytics.ServerRendering.OLAPBase.OlapViewBaseControl.CreateRenderedView(StringBuilder sd)
       at Microsoft.PerformancePoint.Scorecards.ServerRendering.NavigableControl.RenderControl(HtmlTextWriter writer)
    PerformancePoint Services error code 20604.
    2. Unable to create report. Query produced too many results.
    Microsoft.PerformancePoint.Scorecards.BpmException: Unable to create report. Query produced too many results.
       at Microsoft.PerformancePoint.Scorecards.Server.Analytics.AnalyticQueryManager.ExecuteReport(AnalyticReportState reportState, DataSource dataSource)
       at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportBase(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer, String formattingDimensionName)
       at Microsoft.PerformancePoint.Scorecards.Server.PmServer.ExecuteAnalyticReportWithParameters(RepositoryLocation analyticReportViewLocation, BIDataContainer biDataContainer)
    PerformancePoint Services error code 20605.
    Thanks in advance for your help.

    Hello,
    I would like you to try the following to adjust your readerquotas.
    Change the values of the parameters listed below to a larger value. We recommend that you double the value and then run the query to check whether the issue is resolved. To do this, follow these steps:
    On the SharePoint 2010 server, open the Web.config file. The file is located in the following folder:
    \Program Files\Microsoft Office Servers\14.0\Web Services\PpsMonitoringServer\
    Locate and change the the below values from 8192 to 16384.
    Open the Client.config file. The file is located in the following folder:
    \Program Files\Microsoft Office Servers\14.0\WebClients\PpsMonitoringServer\
    Locate and change the below values from 8192 to 16384.
    After you have made the changes, restart Internet Information Services (IIS) on the SharePoint 2010 server.
    <readerQuotas
    maxStringContentLength="2147483647"
    maxNameTableCharCount="2147483647"
    maxBytesPerRead="2147483647"
    maxArrayLength="2147483647"
                  maxDepth="2147483647"
    />
    Thanks
    Heidi Tr - MSFT
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • "Bad Data, too many results for shortname"

    Every 10 minutes since October 13 the wikid error log has recorded the following error message:
    *"Bad Data, too many results for shortname: username"*, always naming the same user, who is not actually doing anything.
    Coinciding with that message at the same time every 10 minutes, the system log records 13 or 14 of the following:
    *"Python\[15645\]: ••• -\[NSAutoreleasePool release]: This pool has already been released, do not drain it (double release)."*
    15645 is a process owned by _teamserver, which would appear to confirm the connection between the python and wikid error messages.
    Last clue: The messages (I have determined in hindsight) started while I was setting up the server to do vacation messages. The user named in the "Bad data" messages was the user who wanted to (and did) set up a vacation message at that time. They worked, too.
    Anyone have any ideas about what is going on and how to fix it? BTW, google does not find even one page where this "Bad data" error message is mentioned.

    Thanks for your response. To answer your questions:
    +Are you using AD for your directory?+ No. OD master only.
    +Are there users with duplicate shortnames in your directory system?+ No, and to double check, I searched with WGM and only the one came up.
    +As a bit of background, the wiki server keeps an private index of user and group information so we can track user preferences, and the "Bad Data, too many results for shortname: username" error is triggered when we do a lookup in that index for a particular user and we (unexpectedly) hit duplicate entries. Are you seeing an issue with using the software, or just an annoying log message?+ It's hard to say (for me) what might be related. The directory or wiki related issues with the server include:
    • A memory issue with slapd that eventually causes it to crash. (preceded by lots of "bdbdbcache: db_open(+various: sn, displayname, givenname, mail, maybe others+) failed: Cannot allocate memory (12)" and "logging region out of memory" and "index_param failed" errors.
    • The wiki is slow, despite very light use.
    • Wake from sleep (network clients with authentication required) can be very slow. Several minutes even.
    Any suggestions you may have would be appreciated.

  • Dimension Filter LOV - Too many results; Refine your search

    Hi,
    I am using Dimension filter in Design Studio which uses the hierarchy dimension. In the preview mode the filter is not showing any members instead its asked to use the search functionality. I understand there is a limit in retrieving the LOV. Is anyway i can increase the number of LOV?
    I need to have this functionality work, The user want to navigate the hierarchy in the filter. Please any help highly appreciated
    Thanks
    VJ

    Hi,
    same question here: DS 1.2 - Too many results; refine your search
    Regards,
    David

  • SQL subquery returning too many rows with Max function

    Hello, I hope someone can help me, I been working on this all day. I need to get max value, and the date and id where that max value is associated with between specific date ranges. Here is my code , and I have tried many different version but it still returning
    more than one ID and date
    Thanks in advance
    SELECT
      distinctbw_s.id, 
    avs.carProd,cd_s.RecordDate,
    cd_s.milkProductionasMilkProd,
    cd_s.WaterProductionasWaterProd
    FROMtblTestbw_s
    INNERJOINtblTestCpcd_sWITH(NOLOCK)
    ONbw_s.id=cd_s.id   
    ANDcd_s.recorddateBETWEEN'08/06/2014'AND'10/05/2014'
    InnerJoin
    (selectid,max(CarVol)ascarProd
    fromtblTestCp
    whererecorddateBETWEEN'08/06/2014'AND'10/05/2014'
     groupby 
    id)avs
    onavs.id=bw_s.id
    id RecordDate carProd       MilkProd WaterProd
    47790 2014-10-05   132155   0 225
    47790 2014-10-01   13444    0 0
    47790 2014-08-06   132111    10 100
    47790 2014-09-05   10000    500 145
    47790 2014-09-20   10000    800 500
    47791 2014-09-20   10000    300 500
    47791 2014-09-21   10001    400 500
    47791 2014-08-21   20001    600 500
    And the result should be ( max carprod)
    id RecordDate carProd       MilkProd WaterProd
    47790 2014-10-05   132155  0 225
    47791 2014-08-21   20001    600 500

    Help your readers help you.  Remember that we cannot see your screen, do not know your data, do not understand your schema, and cannot test a query without a complete script.  So - remove the derived table (to which you gave the alias "avs")
    and the associated columns from your query.  Does that generate the correct results?  I have my doubts since you say "too many" and the derived table will generate a single row per ID.  That suggests that your join between the first
    2 tables is the source of the problem.  In addition, the use of DISTINCT is generally a sign that the query logic is incorrect, that there is a schema issue, or that there is a misunderstanding of the schema. 

  • Pl/Sql block returning too many values

    Hi
    Below is simple pl/sql block.while excecuting this i'm getting too many values exception
    declare
    attrib QW_ACCT_ATTR%ROWTYPE;
    begin
    SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL INTO attrib FROM (SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL FROM QW_ACCT_ATTR where CUST_ACCT_ID='5158660414' AND ATTR_NM = 'SS' ORDER BY ATTR_END_DATE DESC) where rownum = 1;
    DBMS_OUTPUT.PUT_LINE('end daate is...'||attrib.ATTR_END_DATE);
    end;
    could anybody please help me how to rewrite this qwery to get only one record.
    we are not supposed to use cursors here,
    thanks

    I am just changing your logic,
    declare
    attrib QW_ACCT_ATTR%ROWTYPE;
    begin
    SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL INTO attrib FROM (SELECT ATTR_END_DATE, ATTR_NM, ATTR_VAL FROM QW_ACCT_ATTR where CUST_ACCT_ID='5158660414' AND ATTR_NM = 'SS' ORDER BY ATTR_END_DATE DESC where rownum = 1) ;
    DBMS_OUTPUT.PUT_LINE('end daate is...'||attrib.ATTR_END_DATE);
    end;

  • BUG: Searching for the word "united" in Contacts returns far too many results

    To recreate this bug:
    1. I open the Contacts App on my iPhone 5 running iOS 6.0.1.
    2. In the search field within the app, I search for the word "united." (For example, if I am trying to located the address book card for United Airlines).
    3. Instead of showing me just the results of companies/people that have the word "united" in their name or notes field, the app returns almost every single one of my contacts as a search result, EVEN THOUGH THESE PEOPLE DO NOT HAVE THE WORD "UNITED" IN THEIR NAME, DESCRIPTION, OR NOTES FIELD.
    I think this might be happening because I have used the iOS feature of connecting my Contact App with Facebook.  Because of this, many of my contacts have the word "unified contact info" in their description. Although this doesn't entirely explain why searching for the word "united" would show "unified contact info" contacts, the Facebook/Contacts App connection may have something to do with this bug.
    Regardless, if I search for the word "united" on my iPhone, the Contact App still returns almost every single contact as a search result, even though the word "united" cannot be found within those contacts.

    I think it is because the system adds "United States of America" to every address by default.
    You need to search using different parameters, for example, "Airlines".

  • Tag Query History mode returning too many rows of data

    I am running a Tag Query from HQ to a plant site and want to limit the amount of data that returns to the minimum required to display trends on a chart.  The minimum required is subjective, but will be somewhere between 22 and 169 data points for a weeks data.  Testing and viewing the result is needed to determine what is an acceptable minimum. 
    I build a Tag Query with a single tag and set it to History Mode.  I set a seven day period going midnight to midnight.  And I set the row count to 22.  When I execute the query it returns 22 data points.  But when I go to visualization, I get 565 datapoints.  So obviously that is not what I want as I want a very slim dataset coming back from the IP21 server (to minimize the load on the pipe). 
    Any suggestions?

    Hi Michael,
    it looks to me like you have enabled the "Use Screen Resolution" option in your display template or in the applet HTML. Setting this option makes the display template fetch as many rows as there are pixels in the chart area. Like setting a rowcount in the applet HTML as a param, this will override any rowcount limitations you have set at the Query Template level...
    Hope this helps,
    Sascha

  • Too many results in hierarchically query

    Hello all,
    I'm searching for an idea to stop getting results 2, 3 and more times out of the following query
    select
    t.lvl,
    t.syswflvl,
    t.upper,
    LPAD(' ', (lvl)*8)||t.code code,
    LPAD(' ', (lvl)*8)||t.bezeichnung bezeichnung,
    t.chk,
    t.rang
    from (
    select '0' lvl, '0-'||to_char(syswftable,'0000000') syswflvl, '0- 0000000' upper, syscode code, bezeichnung, '' chk, 0 rang from wftable where (select count(wfm.syswftable) from wfm where wfm.syswftable = wftable.syswftable) > 0 union
    select '1' lvl, '1-'||to_char(syswfm,'0000000') syswflvl, '0-'||to_char(syswftable,'0000000') upper, syscode code, kurzbez bezeichnung, anzeigefilter chk, 1 rang from wfm union
    select '2' lvl, '2-'||to_char(syswfa,'0000000') syswflvl, '1-'||to_char(syswfm,'0000000') upper, syscode code, kurzbez bezeichnung, bedingung chk, rang from wfa union
    select '3' lvl, '3-'||to_char(syswfc,'0000000') syswflvl, '2-'||to_char(syswfa,'0000000') upper, syscode code, kurzbez bezeichnung, bedingung chk, rang from wfc union
    select '4' lvl, '4-'||to_char(syswfg,'0000000') syswflvl, '3-'||to_char(syswfc,'0000000') upper, syscode code, kurzbez bezeichnung, bedingung chk, rang from wfg
    ) t
    where ((t.chk not like '%and 0%'
    and trim(t.chk) not like '0%')
    or t.chk is null)
    and upper not like '%-'
    connect by nocycle prior syswflvl = upper
    order siblings by upper, syswflvl, rang
    What happens is, that I get the results from level 0 one times, from level 1 two times, from level 2 three times etc.
    What I'm try to achive is to get only the whole thing once.
    Hope you can see what my problem is ;-)
    Regards
    Carsten

    The effect of not having a start with clause in a hierarchical query is that a hierarchy is produced starting at every possible entry-point. So, you'll get the hierachy from node 1, the hierarchy from all nodes 2, the hierarchy from all nodes 3 and so one. Whether it starts with the correct one or not is not really relevant, as you already figured out that you get too much....
    So, just believe it, add a start with clause...and your problems are gone.

  • Left outer join using date range returns too many rows

    I am trying to pull data for a website.
    Names table:
    company_name varchar2(30)
    julian_day varchar2(3)
    logins number(3)
    login_errors number(3)
    Given a julian date range (e.g. 250-252), I am displaying the information from the Names table.
    The problem is that I also need to display changes (increases/decreases) in the data. I do that by coloring the text based on a 10% increase/decrease. Data for the 3 days 250-252 would be compared to data for the previous 3 days 247-249.
    Not all companies will report data on all days, so some gaps in the data may exist. Therefore, I cannot do just a simple join.
    I am trying to write a query that will give me this information if the user chooses days 250-252.
    Company_name
    sum(logins) for days 250-252
    sum(login_errors) for days 250-252
    sum(logins) for days 247-249
    sum(login_errors) for days 247-249
    The query I'm using is:
    select cur.company_name, sum(cur.logins),
    sum(cur.login_errors), sum(old.logins), sum(old.login_errors)
    FROM names cur LEFT OUTER JOIN names old
    ON cur.company_name = old.company_name
    WHERE cur.adate>='250' and cur.adate<='252'
    and old.adate>='247' and old.adate<='249'
    GROUP by cur.company_name
    Given this data:
    Company_name adate logins login_errors
    ABC 247 10 10
    ABC 248 20 20
    ABC 249 30 30
    ABC 250 15 15
    ABC 251 25 25
    ABC 252 35 35
    My problem is that it returns:
    adate cur.logins cur.login_err old.logins old.login_err
    250 15 15 60 60
    251 25 25 60 60
    252 35 35 60 60
    How can I get it to only give me the one "old" day's data? I went with the LEFT OUTER JOIN because it's possible that there is no data for an "old" day.
    Thanks in advance.....

    Your problem stems from the join itself, and would be the same even without the OUTER JOIN. With your data, there are 3 records in cur and 3 records in old. The join matches each record in cur to each record in old resulting in 9 records in total. Without the SUM, this is clear:
    SQL> SELECT cur.company_name, cur.logins, cur.login_errors,
      2         old.logins, old.login_errors, cur.adate cad, old.adate oad
      3  FROM names cur LEFT OUTER JOIN names old
      4                 ON cur.company_name = old.company_name
      5  WHERE cur.adate>=250 and cur.adate<=252 and
      6        old.adate>=247 and old.adate<=249;
    COMPANY_NA     LOGINS LOGIN_ERRORS     LOGINS LOGIN_ERRORS        CAD        OAD
    ABC                35           35         10           10        252        247
    ABC                25           25         10           10        251        247
    ABC                15           15         10           10        250        247
    ABC                35           35         20           20        252        248
    ABC                25           25         20           20        251        248
    ABC                15           15         20           20        250        248
    ABC                35           35         30           30        252        249
    ABC                25           25         30           30        251        249
    ABC                15           15         30           30        250        249
    9 rows selected.You can do this with only one reference to the table.
    SELECT company_name,
           SUM(CASE WHEN adate BETWEEN 250 and 252 THEN logins ELSE 0 END) curlog,
           SUM(CASE WHEN adate BETWEEN 250 and 252 THEN login_errors ELSE 0 END) curerr,
           SUM(CASE WHEN adate BETWEEN 247 and 249 THEN logins ELSE 0 END) oldlog,
           SUM(CASE WHEN adate BETWEEN 247 and 249 THEN login_errors ELSE 0 END) olderr
    FROM names
    WHERE adate BETWEEN 247 and 252
    GROUP BY company_nameHTH
    John

Maybe you are looking for

  • Voice memos lost after restore. I've tried everything.

    When I plugged my iPhone 5 in a few weeks ago it said it needed to update the software. I clicked OK. It froze hard while doing this. I had to do a restore. That's when I "lost" my voice memos. For voice memos I use the app "Recorder" by Bear-Softwar

  • Need help on adobe forms?explain in details?

    hello experts!!! any body explain about Adobe Forms? wat is Adobe form? purpose? it can work on ecc6.0? pls give me example step by step how to create adobe forms? where i wll get ? and wat is diff.between smartforms & adobeforms?

  • Will Apple cover my factory unlocked iphone 3GS anywhere in the world?

    Hello, I'm planning on buying a factory unlocked iphone 3GS directly from the Apple Store in Hong Kong. Will Apple cover my iphone with the warranty worldwide or only in Hong Kong? Thank you.

  • I need help to Configure the Encryption Key of btm

    In order to monitor the osb 11g. I have download OracleBTM_1of2.zip and I am trying to install it, so I am following this link http://download.oracle.com/docs/cd/E11857_01/install.111/e20124/install.htm#sthref20 how can I do this ? Configuring the En

  • Adobe Reader 9 administrator accounts desktop icon

    Does anyone know how to do the follow as it is quite Adobe 9 is quite annoying: 1 - take off the adobe reader 9 icon off the desktop -- it keeps recreating it after I delete it! NOW WHY WOULD adobe force this on us? 2 - under NON administrator accoun