Ora-03114 running a query with group by

Hi, I've a query with a group by on a sub-query, something like
SELECT <40+ fields>
  FROM (SELECT <40+ fields>
          FROM table
GROUP BY <40+ fields> I don't have any problem running this query directly via toad. This query is a cursor in a procedure in a package and, if I invoke it on the same data, the session crash "with ora-03114 not connected to oracle". If I modify the query selecting less fields, 22, I don't have any problem while with 23 the crash appears.
Furthermore, I don't have any problem in other databases with similar data.
The db version is 9.2.0.6.0 - 64bit
Any idea/advice?
Edited by: 912104 on 3-feb-2012 2.02
Edited by: 912104 on 3-feb-2012 2.03
Edited by: 912104 on 3-feb-2012 2.03

912104 wrote:
I have difficult to have more information, I can only add:
select * from v$version
BANNER
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE    9.2.0.6.0 ;   Production
TNS for IBM/AIX RISC System/6000: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production Can I ask what do you think about the different behavior via toad and via package? I mean, it's possible that is a server bug?
Edited by: 912104 on 3-feb-2012 4.02Are you retrieving the entire result set via toad? or just the first few records?
Are there any TOAD non-fetched column values in your result set, i.e. CLOBS, XMLTypes, nested types?
What does your code do with the cursor? Presumably you don't loop through it and do nothing. Are you sure it's the select that's causing the error, or something you are doing with the data in the procedure?
Can you not adding some instrumentation to your code so that you know exactly what line/data values are processed at the time of the crash? Does it always crash on the same values/line or does it vary?
"Furthermore, I don't have any problem in other databases with similar data." ... what do you mean by "similar data". You only need one odd value in one column to cause you a 3114 in the right circumstances. It seems like you are long way off establishing what exactly the problem is. It's always useful not to close doors to lines of thought. You need to systematically track down the root cause of the issue by exclusion and assumptions are the enemy of that process.

Similar Messages

  • ORA-03113 in spatial query with xmlReader

    I run a spatial query with xmlReader. but it occurs a ORA-03113 exception. If i use the OracleDataReader,not through xml, the execution is ok. But i have to get the geometry data through xml. I have try to set the validate connection to True, but it seems useless.
    Can some one help me?Thx a lots.
    Here is my code:
         string id = "scott";
         string psw = "tiger";
         string source = "Oracle";
         string connectionstring = "User Id="+id+";password="+psw+";data source="+source+";validate connection=true";
         string sql ="select cname from L218 where sdo_relate(L218.GEOLOC,MDSYS.SDO_geometry(2003,NULL,NULL,MDSYS.SDO_elem_info_array(1,1003,3),MDSYS.SDO_ordinate_array(295596.60260187,2761786.9958782, 316370.598147679,2789383.2780762)),'mask=anyinteract')='TRUE'";
         try
              Oracle.DataAccess.Client.OracleConnection con = new OracleConnection(connectionstring);
              con.Open();
              Oracle.DataAccess.Client.OracleCommand cmd = con.CreateCommand();
              cmd.XmlCommandType = OracleXmlCommandType.Query;
              cmd.BindByName = true;
              cmd.CommandText =sql;
              XmlReader xmlReader = cmd.ExecuteXmlReader();
              XmlDocument xmlDocument = new XmlDocument();
              xmlDocument.PreserveWhitespace = false;
              xmlDocument.Load(xmlReader);
              Console.WriteLine(xmlDocument.OuterXml);
              con.Close();
         catch (OracleException e)
              Console.WriteLine(e);
    And it returns:
    Oracle.DataAccess.Client.OracleException ORA-03113: end-of-file on communication
    channel at Oracle.DataAccess.Client.OracleCommand.XmlHandleException(OracleE
    xception e)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteXmlQuery(Boolean wantResult)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteXmlReader()

    Hi Daniel
    I ran the validation and some of the geometries were invalid. I have now corrected these and all are OK. The db version is 817. However, I am still getting the same error. It appears to be dependant on what cordinates the query is searching:
    Errors
    SELECT 1
    FROM wpe_misc_site, WPE_PLAN_APPLICATION
    WHERE wpe_misc_site.ste_id > 0
    AND WPE_PLAN_APPLICATION.APL_ste_id(+) =
    wpe_misc_site.ste_id
    AND mdsys.sdo_relate(ste_geometry,
    MDSYS.SDO_GEOMETRY(2003, 81989, NULL,
    MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),
    MDSYS.SDO_ORDINATE_ARRAY(278792,187310,278876,187393)),
    'mask=anyinteract querytype=window') = 'TRUE';
    Substriute those coordinates for 278792,187308,278876,187393 and query works.
    Any ideas??
    Thanks
    Chris

  • Run the query with previous weeks date automatically

    Hi Guyz,
    I need to  dynamically populate the previous weeks  date value every week,
    i.e Run the query every Monday automatically, with previous weeks date value .
    Is there any SAP Exit which I can use ??
    Regards,
    Ravi
    Edited by: Ravi Srinivas on Aug 4, 2009 1:40 PM
    Edited by: Ravi Srinivas on Aug 4, 2009 1:52 PM

    Ravi,
    If you are thinking of re-running the previous week's queries automatically in the front-end, then U. Tummers is correct.  You can create new columns alongside your existing query if you so wish and use your restrictions with an offset sepending on how far back you'd like to go.
    Best,
    Philips

  • Incorrect warning when parsing query with group by clause

    I am using SQL Developer 4.0.0.13.80 with JDK 1.7.0_51 x64 on Windows 8.1
    I have the following SQL, which works perfectly:
    select substr(to_char(tot_amount), 0, 1) as digit, count(*)
    from transactions
    where tot_amount <> 0
    group by substr(to_char(tot_amount), 0, 1)
    order by digit;
    However, SQL Developer is yellow-underlining the first line, telling me that:
    SELECT list is inconsistent with GROUP BY; amend GROUP BY clause to: substr(to_char(rep_tot_amount), 0, 1), substr(to_char(rep_tot_amount),
    which is clearly wrong.
    Message was edited by: JamHan
    Added code formatting.

    Hello,
    I also have found the same issue with the GROUP BY hint. Another problem I found is that the hint suggests to amend the GROUP BY members to add also constant values that are included in the SELECTed columns and whenever those constants include strings with spaces, it generates an invalid query. Normally, constant values won't affect grouping functions and as such they can be omitted from the GROUP BY members, but it seems SQL Dev thinks it differently.
    For example, if you try the following query:
    SELECT d.DNAME, sum(e.sal) amt, 'Total salary' report_title, 100 report_nr
    FROM scott.emp e, scott.dept d
    WHERE e.DEPTNO = d.DEPTNO
    GROUP BY d.DNAME;
    when you hover the mouse pointer on the yellow hint, a popup will show the following message:
    SELECT list inconsistent with GROUP BY; amend GROUP BY clause to:
    d.DNAME, 'Total, 100
    If you click on the hint, it will amend the group by members to become:
    GROUP BY d.DNAME, 'Total, 100;
    that is clearly incorrect syntax. You may notice that after the change the yellow hint is still there, suggesting to amend further the GROUP BY members. If you click again on the hint, you will end with the following:
    GROUP BY d.DNAME, 'Total, 100;
    , 'Total, 100
    and so on.
    I am not sure if this behaviour was already known (Vadim??), but it would be nice if somebody could file a bug against it.
    Finally when writing big queries with complex functions and constant columns, those yellow lines extend all over the select list and they are visually annoying, so I wonder if there is a way to disable the GROUP BY hint until it gets fixed.
    Thanks for any suggestion,
    Paolo

  • Problem for running Update query with Chinese

    Hi all,
    I am running a web application in Lotus Domino.
    I have a Lotus Script Agent which need to update Oracle 8i Database with Chinese Character throught ODBC but i find that all characters become some strange characters.
    I got the problem only for update query.
    I have no problem for select query for getting the chinese data.
    Also, I got no problem to run the update query with chinese characters in Sqlplus.
    I also try to run the same update query which the ODBC connection is pointing to an MS Access Database. It works too.
    So the only things i leave is the Oracle ODBC driver.
    Anythings I should do for the Oracle ODBC server?
    Thanks very much.

    Hi, I checked the registry of Oracle and
    in the NLS_LANG field, the values is AMERICAN_AMERICA.UTF8. In the server side, I set the same.
    It should be okay, as i can retrieve the chinese content in the Oracle. Just that when i try to run a query contain chinese, such as,
    "insert into TableA values ('���')". i will got some strange character inserted in the databasae.
    Could you tell me what should i do?
    Thanks a lot a lot.

  • Can we run a query with variable screen at start up in Bex Analyzer

    Hello all,
    I have a query which asks for fiscal year and posting period at the start of query run. But when I run the query in analyzer, it gives me this error all the time.
    "Program error in class SAPMSSY1 method : UNCAUGHT_EXCEPTION
    System error in Program CL_RSR_REQUEST and form TEXT_ELEMENTS_GET: VARIABLE"
    Can someone help,
    Thanks in advance.

    Hello,
    Please check if OSS note 858458 is applicable in your case.
    Regards,
    Praveen

  • How to write a query with group by and order by for a date column

    I have a query:
    select count(*), to_char(s.pdate,'Mon-yyyy') as month from sTable s
    group by to_char(s.pdate,'Mon-yyyy')
    order by to_date(s.pdate,'Mon-yyyy')
    However, I got an error: not a GROUP By expression.
    If i just run: select count(*), to_char(s.pdate,'Mon-yyyy') as month from sTable s
    group by to_char(s.pdate,'Mon-yyyy')
    it is work fine.
    How to solve the problem.
    Thanks,
    Jen

    Jen,
    You can use this code
    with sTable as (select to_date('01/01/2009', 'dd/mm/yyyy') pdate,  1 code from dual union all
                  select to_date('02/02/2009', 'dd/mm/yyyy') a, 2 code from dual union all
                  select to_date('01/03/2009', 'dd/mm/yyyy') d, 3 code from dual union all
                  select to_date('05/04/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/05/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/06/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/07/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/08/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/09/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/10/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/11/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/12/2009', 'dd/mm/yyyy') h, 5 code from dual)
    select cnt, to_char(to_date(mnt||'01', 'yyyymmdd'), 'Mon-yyyy')
      from (select count(*) cnt, to_char(s.pdate,'yyyymm') as mnt
              from sTable s
             group by to_char(s.pdate,'yyyymm')
             order by to_char(s.pdate,'yyyymm')
           CNT MONTH
             1 Jan-2009
             1 Feb-2009
             1 Mar-2009
             1 Apr-2009
             1 May-2009
             1 Jun-2009
             1 Jul-2009
             1 Aug-2009
             1 Sep-2009
             1 Oct-2009
             1 Nov-2009
             1 Dec-2009
    12 rows selectedyour problem was that you are using a expresión in the order by (to_date...) that is distinct to the query results (to_char...).
    Regards,
    Mike

  • Strange behavior in inner query with group by clause

    Hi All,
    I found a very strange behaviour with Inner query having a group by clause.
    Please look the sample code
    Select b,c,qty from (select a,b,c,sum(d) qty from tab_xyz group by b,c);
    This query gives output by summing b,c wise. But when i run the inner query it gives error as "not a group by expression "
    My question is - though the inner query is wrong, how is it possible that this query gives output.
    it behaves like -
    Select b,c,qty from (select b,c,sum(d) qty from tab_xyz group by b,c);
    Is it a normal behaviour ?
    If it is a normal behaviour, then how group by behaves inside a inner query.
    Thanks !!

    This case I have tested already and it throws error.
    But why the initial posted query is not throwing
    error even the inner query is wrong.
    In what way oracle behaves for the initial posted
    query?what is the scenario that throws the error? is it at the time when you only run the inner query or the whole query?

  • Query with group by clause

    Hi all,
    I am struggling with one query.So Just i am giving the example..
    CREATE TABLE test(num NUMBER,val NUMBER,description VARCHAR2(100))
    table having the following data
    num val description
    1 100 first
    1 200 second
    1 300 third
    Now i want to take the sum and discription based on num field..
    i should get like ==> 1 600 first
    my query is...
    SELECT SUM(val),description
    FROM test
    GROUP BY description
    But it's giving all records.because description field is there in select statement..
    I tried two cursors for this case..its o.k
    But Is there any way instead of using two cursors.
    Thanks,

    Not sure what you are trying to achieve here. For the same value of NUM (say 1), you have 3 different values of VAL & DESCRIPTION. Do you want to sum up the VAL values for a particular value of NUM? In that case, what will be the corresponding DESCRIPTION?
    How did you arrive at the result --- 1 600 first
    -- whereas the DESCRIPTION is different for the 3 VAL values?

  • Query with group by and max value

    Hi,
    I have a table with many values of VAR_TRIMESTRALE for each COD_ISIN so I would take only the rows, for each COD_ISIN, that have the maximum of VAR_TRIMESTRALE.
    select *
    from spr_isin_drm_to b
    group by b.COD_ISIN
    having max(b.VAR_TRIMESTRALE)
    I have tried to write the query in this way but it's wrong.
    How can I write the correct query?
    Thanks, bye bye.

    Hi,
    This is an example of a "Top-N" query:
    SELECT   *       -- or list, if you don't want to see r_num
    FROM    (
            SELECT  b.*
            ,       RANK () OVER
                        ( PARTITION BY  cod_isin
                          ORDER BY    var_trimestrale   DESC
                        )  AS r_num
            FROM    spr_isin_drm_to    b
    WHERE   r_num = 1
    ;

  • SQL statement running balance query with previous balance taken into account

    Hi Guys
    I have a SQL statement which caclulates the running balance
    for a list of transactions in a transactions table. This SQL
    statement is as follows:
    SELECT transID, debit, credit,
    (SELECT SUM(debit-credit)
    FROM transactions as D1
    WHERE D1.transID <= D0.transID) AS balance
    FROM transactions AS D0
    The only problem I'm having is that I have to display
    transactions between a particular date range. I have for eg.
    transID, transDate, debit, credit fields in my db.
    However the problem I'm having is that when the transaction
    records are pulled out for the specified date range the balances
    are only calculated for those records. I need someway of having a
    balance b/f (brought forward) so that the selected records use that
    as a 'starting' balance and then calculate the running balance as
    normal.
    Any easy solutions?
    Many, many thanks for your help in advance.
    All the best
    Wesley

    You'd need to determine the b/f then apply it against the
    transaction records when they are pulled for a date range. So if
    the date range is
    Feb 1st, 2009 -> Feb 28th, 2009
    You'd need to also get the previous balance in a separate
    query, then use it to correctly display the running balance when
    you output the date range.
    I suppose a simpler way involving a little more DB work (and
    possibly lots of coding) is to store the current balance as well
    with each transaction; then when performing a date range you'd have
    the balance as well and not have to calculate it on the fly.

  • Changing DEFAULT_WHERE of a FROM CLAUSE Query (with group by)

    I have a Data Block of type FROM CLAUSE Query.
    The Data Source Name is
    SELECT A2.NAME,A2.EMPLOYEEID,A1.ORGID,A1.FSCLYEARID,A1.STATUS,COUNT(*) AS COUNTER
    FROM S_PLC10300 A1,S_PLC50200 A2
    WHERE A1.EMPLOYEEID=A2.EMPLOYEEID
    GROUP BY A1.ORGID,A1.FSCLYEARID,A1.STATUS,A1.EMPLOYEEID,A2.NAME,A2.EMPLOYEEID
    I have a Query Area with text items which i use to change the DEFAULT_WHERE Property.
    My problem is that i can' t put in the DEFAULT_WHERE a field that doesn't belong to the SELECT Clause. Is there a way to achieve this?
    Maybe changing the whole Data Source Name at runtime ?
    Thanks

    As I said i have a block with FROM clause query:
    SELECT A1.ORGID,A1.FSCLYEARID,A1.STATUS, A1.EMPLOYEEID, A2.NAME,A2.EMPLOYEEID
    FROM S_PLC10300 A1,S_PLC50200 A2
    WHERE A1.EMPLOYEEID=A2.EMPLOYEEID
    GROUP BY A1.ORGID,A1.FSCLYEARID,A1.STATUS,A1.EMPLOYEEID,A2.NAME,A2.EMPLOYEEID
    i use the following code:
    set_block_property(BLOCK,DEFAULT_WHERE,'A1.TRNSDATE>=:QUERY_BLOCK.TRNDATE);
    What i think the code will do is change the FROM Clause Query to:
    SELECT ... WHERE A1.EMPLOYEEID=A2.EMPLOYEEID AND A1.TRNSDATE>=:QUERY_BLOCK.TRNDATE
    GROUP BY ...
    A1.TRNSDATE is a valid field of table A1.
    I can' t add TRNSDATE to my SELECT clause because i will have to add it to the GROUP BY clause.
    Hope i made more sense this time.
    Thanks

  • Query with group - by

    I am having a table 'status' that has two columns plan_day,plan_name.
    plan_day contains values as MON,TUE...SUN.
    For every day i inserted some data into plan_name.
    Now, I need a query that displays the plan_name for the plan_day.
    i.e., If i created plan1 on MON and plan2,plan3 on TUE
    I should get Plan1 for MON and Plan2,Plan3 for TUE.
    I wrote the query as,
    select plan_day,plan_name from status group by plan_day,plan_name.
    But I am getting all the three plans for both days. How can I acheive this.
    Regards
    Raghunadh

    If you want to implement it in SQL you can do it -
    SCOTT>
    SCOTT>
    SCOTT>with t
      2  as
      3    (
      4       select 'MON' plan_day, 'CHX_PUD' plan_name from dual
      5       union all
      6    select 'MON', 'COS_PUB' from dual
      7    union all
      8    select 'MON', 'PUB_HOL' from dual
      9    union all
    10    select 'TUE', 'CHX_PUD' from dual
    11    union all
    12    select 'TUE', 'PUD_MON' from dual
    13    ),
    14   proc
    15   as
    16     (
    17   select plan_day,
    18          lag(plan_day,1) over(partition by plan_day order by plan_day) pre_plan_day,
    19          plan_name
    20   from t
    21     )
    22  select case
    23           when plan_day = pre_plan_day then
    24              null
    25         else
    26           plan_day
    27         end plan_day,
    28         plan_name
    29  from proc;
    PLA PLAN_NA
    MON CHX_PUD
        COS_PUB
        PUB_HOL
    TUE CHX_PUD
        PUD_MON
    Elapsed: 00:00:00.00
    SCOTT>Regards.
    Satyaki De.

  • Query with GROUP BY ROLLUP

    I have a query :
    SELECT e.deptno,d.dname,e.job,SUM(e.sal)
    FROM emp e,dept d
    WHERE e.deptno = d.deptno
    GROUP BY ROLLUP(e.deptno,d.dname,e.job)
    which gives the output with Deptno and Dept Name repeated for every row, I want them to appear only once for each Dept Num.
    Can you folks help me out on this.
    Thanks and Regards,
    Gaurav Srivastava

    scott@ORA92> BREAK  ON deptno ON dname
    scott@ORA92> SELECT e.deptno, d.dname, e.job, SUM(e.sal)
      2  FROM   emp e, dept d
      3  WHERE  e.deptno = d.deptno
      4  GROUP  BY ROLLUP (e.deptno, d.dname, e.job)
      5  ORDER  BY e.deptno, d.dname, e.job
      6  /
        DEPTNO DNAME          JOB       SUM(E.SAL)
            10 ACCOUNTING     CLERK           1300
                              MANAGER         2450
                              PRESIDENT       5000
                                              8750
                                              8750
            20 RESEARCH       ANALYST         6000
                              CLERK           1900
                              MANAGER         2975
                                             10875
                                             10875
            30 SALES          CLERK            950
                              MANAGER         2850
                              SALESMAN        5600
                                              9400
                                              9400
                                             29025
    16 rows selected.

  • Select query with group and sum

    Friends I have a table which has a list of item that are sold in many provinces and their selling price.
    EMP_TABLE
    item_code
    item_desc
    item_province
    item_selling_price
    Now I want a query which a row containing
    distinct item code ,item desc,province ,sum of item_selling_price for Ontario,sum of item_selling_price for British Columbia,sum of item_selling_price for Quebec
    Can anyone please tell me how to do it.
    thx
    m

    Hello
    It's always usefull to provide some test data and create table scripts etc, but does this do what you're after?
    create table dt_test_t1
    (item_code                     varchar2(3),
    item_desc                    varchar2(10),
    item_province               varchar2(20),
    item_selling_price          number(3)
    ) tablespace av_datas;
    INSERT INTO dt_test_t1 VALUES('ABC','Item1','Province1',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item1','Province2',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item1','Province2',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item2','Province1',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item2','Province1',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item2','Province1',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item3','Province2',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item3','Province2',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item3','Province2',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item4','Province1',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item4','Province1',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item4','Province2',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item5','Province2',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item5','Province1',10);
    INSERT INTO dt_test_t1 VALUES('ABC','Item5','Province2',10);
    SQL> SELECT
      2     item_code,
      3     item_desc,
      4     SUM(DECODE(item_province,'Province1',item_selling_price,0)) province_1_total,
      5     SUM(DECODE(item_province,'Province2',item_selling_price,0)) province_2_total
      6  FROM
      7     dt_test_t1
      8  GROUP BY
      9     item_code,
    10     item_desc;
    ITE ITEM_DESC  PROVINCE_1_TOTAL PROVINCE_2_TOTAL
    ABC Item1                    10               20
    ABC Item2                    30                0
    ABC Item3                     0               30
    ABC Item4                    20               10
    ABC Item5                    10               20HTH
    David

Maybe you are looking for

  • Layout in sql report gets disturbed in case of blank columns

    Hi All, I have an SQL report which runs from a concurrent program. Problem is, if there are blank columns in the report then the data shifts to the left. As shown in the below table, if column Attribute 4 is null then the data for Error column has sh

  • RE: iMovie wont play 2 separate tunes?

    I have tried importing a second audio clip into iMovie as I obviously don't want the same tune throughout the clip, but it doesn't play the second tune? Is the reason the same as a previous post/answer about the tune coming from iTunes Store & it bei

  • Segmentation of Organizations related to other Organizations

    Hi Experts, I am trying to segment Organizations (e.g. Sold-tos) that are related other Organizations (e.g. Buyers). Buyers are not created as contact persons but as corporate accounts as well and are connected to the Sold-to via the relationship "Ha

  • Standard users forced default "run as administrator" for acrobat.exe X pro

    The software has been reinstalled and patched CS6 all componets of CS6 run fine under a standard user account with the exception of Acrobat Pro.  Acrobat Pro runs fine when an administrator is logged in BUT when a standard user logs into the computer

  • Calling variable set in Scene 1

    apologies for the repost/redo but previous did not work as I thought it did! I'm working with Scene 1 with 2 buttons, "Corporate" and "Editorial" and a movie clip, mcMainScreenArea. I want the buttons to set a variable which can be called in movie cl