Bug in 11g CUBE_TABLE function?

An unusual feature of the 11g OLAP CUBE_TABLE function has surfaced when querying a dimension.
If a dimension has more than one hierarchy then if CUBE_TABLE is used to query a second or subsequent hierarchy on a dimension, and a WHERE clause on the DEPTH column is specified, no records will appear regardless of the value queried.
eg. Imagine a dimenson TIME with two hierarchies FINANCIAL and CALENDAR (FINANCIAL having been defined first).
The query "SELECT DEPTH, COUNT(*) DCOUNT from TABLE(CUBE_TABLE('TIME;FINANCIAL')) GROUP BY DEPTH ORDER BY DEPTH" will list how many dimension values have each value of DEPTH
The query "SELECT * from TABLE(CUBE_TABLE('TIME;FINANCIAL')) WHERE DEPTH=0" will show the entire record corresponding to the top of the FINANCIAL hierarchy
Repeat this for hierarchy CALENDAR.
The first query will work correctly but the second will return an empty record set.
I would say this is a bug.
To demonstrate this effect in your own database you can run the following procedure (it will loop though all your dimensions and run these two queries.):-
create or replace
PROCEDURE SHOW_CUBE_TABLE_ERROR AS
BEGIN
DECLARE
OLINE VARCHAR2(100);
SLINE VARCHAR2(300);
CURSOR ahv IS SELECT owner, dimension_name, hierarchy_name FROM sys.all_cube_hierarchies ;
TYPE dynCurTyp IS REF CURSOR;
dyn dynCurTyp;
RDEPTH INTEGER;
RCOUNT INTEGER;
BEGIN
FOR item IN ahv LOOP
OLINE := item.owner || '.' || item.dimension_name || ';' || item.hierarchy_name;
DBMS_OUTPUT.PUT_LINE(OLINE);
DBMS_OUTPUT.PUT_LINE(LPAD('=',LENGTH(OLINE),'='));
SLINE := 'SELECT DEPTH, COUNT(*) DCOUNT FROM TABLE(CUBE_TABLE(''' || OLINE || ''')) GROUP BY DEPTH ORDER BY DEPTH';
DBMS_OUTPUT.PUT_LINE(SLINE);
OPEN dyn FOR SLINE;
DBMS_OUTPUT.PUT_LINE('DEPTH DCOUNT');
DBMS_OUTPUT.PUT_LINE('----- ------');
LOOP
FETCH dyn INTO RDEPTH, RCOUNT;
EXIT WHEN dyn%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(LPAD(RDEPTH, 5, ' ') || LPAD(RCOUNT, 9, ' '));
END LOOP;
DBMS_OUTPUT.PUT_LINE(' ');
CLOSE dyn;
SLINE := 'SELECT count(*) DCOUNT FROM TABLE(CUBE_TABLE(''' || OLINE || ''')) where DEPTH=0';
DBMS_OUTPUT.PUT_LINE(SLINE);
OPEN dyn FOR SLINE;
DBMS_OUTPUT.PUT_LINE('DCOUNT');
DBMS_OUTPUT.PUT_LINE('------');
LOOP
FETCH dyn INTO RCOUNT;
EXIT WHEN dyn%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(LPAD(RCOUNT, 6, ' '));
END LOOP;
DBMS_OUTPUT.PUT_LINE(' ');
CLOSE dyn;
DBMS_OUTPUT.PUT_LINE(' ');
END LOOP;
END;
END SHOW_CUBE_TABLE_ERROR;

David
Thanks for replying.
1) I am using version Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production (A patch)
2) There currently only is one schema but the problem is reproduceable in all AW's
3) Attaching all AW's explicitly and performing ALLSTAT does not affect the result
4) Reversing the order of the hierarchies does not affect the result either
I have modified my procedure to perform actions (3) and (4)
create or replace
PROCEDURE SHOW_CUBE_TABLE_ERROR(REVHIER BOOLEAN) AS
BEGIN
DECLARE
THISAW VARCHAR2(20);
OLINE VARCHAR2(100);
SLINE VARCHAR2(300);
CURSOR awl IS SELECT aw_name FROM sys.user_aws;
TYPE ahvCurTyp IS REF CURSOR;
ahvr ahvCurTyp;
TYPE dynCurTyp IS REF CURSOR;
dyn dynCurTyp;
ROWNER VARCHAR2(20);
RDIMENSION VARCHAR2(20);
RHIERARCHY VARCHAR2(20);
RDEPTH INTEGER;
RCOUNT INTEGER;
BEGIN
FOR item IN awl LOOP
THISAW := item.aw_name;
dbms_aw.execute('aw attach ' || THISAW || ' ro');
END LOOP;
IF REVHIER THEN
OPEN ahvr for 'SELECT owner, dimension_name, hierarchy_name FROM sys.all_cube_hierarchies ORDER BY owner, dimension_name, hierarchy_name desc';
ELSE
OPEN ahvr for 'SELECT owner, dimension_name, hierarchy_name FROM sys.all_cube_hierarchies ORDER BY owner, dimension_name, hierarchy_name asc';
END IF;
LOOP
FETCH ahvr INTO ROWNER, RDIMENSION, RHIERARCHY;
EXIT WHEN ahvr%NOTFOUND;
--FOR item IN ahv LOOP+
--THISAW := dbms_aw.eval_text('obj( aw ''' || item.dimension_name || ''')');+
--OLINE := item.owner || '.' || item.dimension_name || ';' || item.hierarchy_name;+
THISAW := dbms_aw.eval_text('obj( aw ''' || RDIMENSION || ''')');
OLINE := ROWNER || '.' || RDIMENSION || ';' || RHIERARCHY;
DBMS_OUTPUT.PUT_LINE(OLINE || ' (AW: ' || THISAW ||')');
DBMS_OUTPUT.PUT_LINE(LPAD('=', LENGTH(OLINE) LENGTH(THISAW) + 7,'='));+
dbms_aw.execute('aw attach ' || THISAW || ' first');
dbms_aw.execute('allstat');
SLINE := 'SELECT DEPTH, COUNT(*) DCOUNT FROM TABLE(CUBE_TABLE(''' || OLINE || ''')) GROUP BY DEPTH ORDER BY DEPTH';
DBMS_OUTPUT.PUT_LINE(SLINE);
OPEN dyn FOR SLINE;
DBMS_OUTPUT.PUT_LINE('DEPTH   DCOUNT');
DBMS_OUTPUT.PUT_LINE('-----   ------');
LOOP
FETCH dyn INTO RDEPTH, RCOUNT;
EXIT WHEN dyn%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(LPAD(RDEPTH, 5, ' ')  || LPAD(RCOUNT, 9, ' '));
END LOOP;
DBMS_OUTPUT.PUT_LINE(' ');
CLOSE dyn;
SLINE := 'SELECT count(*) DCOUNT FROM TABLE(CUBE_TABLE(''' || OLINE || ''')) where DEPTH=0';
DBMS_OUTPUT.PUT_LINE(SLINE);
OPEN dyn FOR SLINE;
DBMS_OUTPUT.PUT_LINE('DCOUNT');
DBMS_OUTPUT.PUT_LINE('------');
LOOP
FETCH dyn INTO RCOUNT;
EXIT WHEN dyn%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(LPAD(RCOUNT, 6, ' '));
END LOOP;
DBMS_OUTPUT.PUT_LINE(' ');
CLOSE dyn;
DBMS_OUTPUT.PUT_LINE(' ');
END LOOP;
END;
END SHOW_CUBE_TABLE_ERROR; ------------------------------------------------------------------------------------------------------------------------------------------------------
I am not alone in noticing this issue. The developers at Simba said they'd seen it too but that it was fixed in the B patch. Any idea when this is available for Windows?
Paul

Similar Messages

  • HT1665 There is a bug in the spellchecking functionality when typing in the web view or while using Blogsy App. Why? Why my IPad crashes so often?

    There is a bug in the spellchecking functionality when typing in the web view or while using Blogsy App. Why? Why my IPad crashes so often?

    I have always found spell check to be "buggy" in every version of all of the iOS's that I have run on my original model iPad and my new iPad - especially when replying and typing posts in these forums. It works perfectly in every other application on my iPad but it has never worked perfectly in any web browser that I have used on my iPad - no matter what I have done to try to correct it. That is what MY experience has been with spell check on my iPads.
    As for the crashes on your iPad try these basic troubleshooting steps.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    Quit all apps and restart. Go to the home screen first by tapping the home button. Quit/close open apps by double tapping the home button and the task bar will appear with all of you recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner to close the apps. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.

  • BUG in Blackberry 8700v functionality....

    In my view there is a bug in Blackberry 8700v functionality. its in the functionality of keypad lock.
    Regards,
    Abhinav Arya
    {edit}
    Message Edited by cathy298 on 10-13-2009 10:48 PM

    charmingnavy wrote:
    M not sure whether this is a right place to publish this
    Then why do you pop in with this "seekrit". This isn't junior high school where pass a friend in study hall and whisper "I know a seekrit about JoeBob but I can't tell you!"
    charmingnavy wrote:
      and with which team you are assiciated with...
    I root for Alabama. Roll Tide!
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Any solution to the iOS 6 bug for auto lock function for the iPhone 4S

    Any solution to the iOS 6 bug for auto lock function for the iPhone 4S

    My guess is they don't care. Most likely they're illiterate and don't know what a colon is for. They probably think it's a little-used character. Remember: these are the people who don't know the difference between "deprecate" and "depreciate".
    I have the same colon problem as you do. But it's not the biggest problem I have encountered in Lion. If it was only that I'd be Mr. Delighted with Lion. There's worse than having a colon - uh -  that won't cooperate. A lot worse, in Lion.

  • 11g Cached function feature alternative in 10g ?

    All:
    I want to know if there is a feature or alternative that i could implement the 11g cached function sort of thing where i could share the data via passed parameters by reference of a cached object across sessions.
    Thanks
    Srinivas

    It appears the Package variables and data are session specific and cannot be shared across sessions.
    Yes... i'm sure !!!!!Sim,
    package global variables are NOT shared accross sessions. The link you pointed to showed only that within the same session the variables may be shared.
    Changing he session leads to reinitialized variables as a simple test reveals:
    SQL> connect scott/tiger
    Connected as SCOTT
    SQL> begin
       owa.user_id := 'My User';
       dbms_output.put_line ('User: ' || owa.user_id);
    end;
    User: My User
    PL/SQL procedure successfully completed.
    SQL> connect scott/tiger
    Connected as SCOTT
    SQL> begin
       dbms_output.put_line ('User: ' || owa.user_id);
    end;
    User:
    PL/SQL procedure successfully completed.

  • Known bugs in 11g beta?

    Hi,
    I am using the 11g beta (ODAC1110510beta) but have come across a problem related to using functions (e.g Upper) in the where clause of a select statement. This code used to work with earlier versions of ODP.NET.
    Is there a list of known bugs in the beta, and where can I find it?
    (I have not yet a small test case to demonstrate the bug, but I am working on it.)
    Thanks

    how are you using the UPPER function ?? if you could post the SQL Code it would help... i am using UPPER and it works for me with the 11g tools...

  • Acrobat 9 bug? - Print Pages function does not print all bookmarked pages

    We use the Bookmark Print Pages function to allow for easy printing of sections of large PDFs. All of the pages that should be printed are bookmarked. The bookmarked pages print correctly in Adobe 8, but not in Adobe 9.
    I have put together a javascript workaround, but would prefer a solution that does not require distributing a file to all users.
    I would appreciate any suggestions on other possible workarounds.
    Here is the bug report I submitted to Adobe:
    Concise problem statement: The "Print Pages" function for bookmarks does not print all bookmarked pages in Adobe Reader 9.0 and 9.1. The same bookmarks print properly in Adobe Reader, Standard, and Pro 8.
    Steps to reproduce bug:
    1. Open the Adobe Acrobat SDK JavaScript for Acrobat API Reference PDF (Version 8.1, April 2007) in Adobe Reader 9.0 or 9.1.
    2. View the bookmarks. Right-click on New Features and Changes and choose "Print Pages."
    3. Open the same PDF in Adobe Reader, Standard, or Pro 8. (I used Adobe Professional 8.1.3.)
    4. View the bookmarks. Right-click on New Features and Changes and choose "Print Pages."
    Results and Expected results: Printing from v8 results in 12 pages. Printing from v9 results in 9 pages. Pages 741, 754, and 769 did not print from v9.

    I'm having the same issues.  Using the latest version 9.3.3.  Is this a bug? I tired calling adobe but their CR sounds like 3rd country only.  Anyone can shed a light on this issue?

  • Oracle 11g Table function returns no records on first call

    Hello,
    On a Oracle 11g R2 I've a table function ( PIPELINED ) returning rows selected from a table.
    The first time the function is selected, in a session ( I've tried to disconnect and log in again ), it returns no rows.
    I've tried to log the call using DBMS_OUTPUT and from what I see the select on the table function returns no rows and no output is printed. So I presume Oracle is not calling the function.
    The same function on a similar environment ( same db versions, patches and database structure ) works fine. The second environment is a production environment so it has more memory and some other settings enabled.
    Does anyone know of settings that can relate to this behaviour ?
    Thanks in advance for the help.
    Regards,
    Stefano Muret

    Thank you for answering so fast.
    Here's the function code:
    FUNCTION template_parameters (iTemplate IN TEMPLATE_RAW_DATA.TMPL_ID%TYPE := NULL)
    RETURN table_type_tmpl_parameters PIPELINED
    IS
    li_exception INTEGER DEFAULT -20025;
    POUT_PARM TABLE_TYPE_TMPL_PARAMETERS;
    lt_parms table_type_tmpl_parms_raw;
    sParmCheck VARCHAR2(4000);
    iOccurrence INTEGER;
    BEGIN
    pOut_Parm := table_type_tmpl_parameters();
    pOut_Parm.EXTEND;
    select
    tmpl_id
    *,tmpl_name*
    *,replace(upper(trim(sql_out)),'[SCHEMA].')*
    *,UPPER(TRIM(out_tmpl_parms))*
    bulk collect into lt_parms
    from ref_templates
    where tmpl_id = NVL(iTemplate,tmpl_id)
    order by tmpl_id;
    FOR k IN 1..lt_parms.COUNT
    LOOP
    pOut_Parm(1).tmpl_id := lt_parms(k).tmpl_id;
    pOut_Parm(1).tmpl_name := lt_parms(k).tmpl_name;
    FOR i IN 1..2
    LOOP
    IF i = 1 THEN
    sParmCheck := lt_parms(k).sql_out;
    ELSE
    sParmCheck := lt_parms(k).sql_parms;
    END IF;
    iOccurrence := 1;
    *pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
    WHILE pOut_Parm(1).parameter_name IS NOT NULL
    LOOP
    PIPE ROW (pOut_Parm(1));
    iOccurrence := iOccurrence + 1;
    *pOut_Parm(1).parameter_name := regexp_substr(sParmCheck,'\[[^\[]+\]',1,iOccurrence);*
    END LOOP;
    END LOOP;
    END LOOP;
    RETURN;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE_APPLICATION_ERROR(li_exception,SUBSTR(SQLERRM,1,1000));
    RETURN;
    END template_parameters;
    This function is part of a package.
    The data on both environments is the same.

  • Bug with ResultSet.wasNull() function

    The wasNull() function is incorrectly reporting false when null values are read for doubles. This is in conjunction with the Oracle 10gr2 classes12.jar driver.
    The case where I am seeing this is for a left outer join SQL statement. Double columns on the right side of the join are reporting false with wasNull when they are in fact null. I haven't tested other conditions yet.
    Is this a documented bug?
    Also, I apologize if there is a more appropriate forum for this question. If so, just let me know and I'll post there.

    Hi ,
    There is a bug mentioned on http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4424215.
    You can go through this for the fix release.
    -Priyanka

  • Bug? using MAX() function on char(1) column returns something larger

    details:
    -- we have a complex nested query, where we are essentially returning the max() value into a variable
    -- the max() function is being used on a char(1) column
    -- where MAX() is part of an inner select, we have started getting
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    errors.
    SELECT MAX(X) INTO var FROM ... works in 9i and 10g
    SELECT X INTO var FROM (SELECT MAX(X) X FROM ... worked in 9i, does not work in 10g!
    -- We never had problems with the code until upgrading to 10g release 2.
    -- the Solution is to cast the final value with TO_CHAR(). The cast MUST be done at the outer most point of the select:
    SELECT TO_CHAR(X) INTO var FROM (SELECT MAX(X) X FROM ... works
    SELECT X INTO var FROM (SELECT TO_CHAR(MAX(X)) X FROM ... causes an error!
    The following script demonstrates the issue, and includes the solution:
    * October 3, 2006
    * Possible SQL bug introduced with Oracle 10G
    * Natalie Gray DBA/Developer, Environment Canada
    * Description:
    * Have discovered a problem with using the MAX() function
    * on columns of type char(1)
    * only an issue when used in an inner select
    * solution (see test 4)
    CREATE TABLE SQL_BUG_TEST
    X NUMBER,
    Y NUMBER,
    Z CHAR(1)
    INSERT INTO SQL_BUG_TEST (X, Y, Z)
    VALUES (1,1,'A');
    INSERT INTO SQL_BUG_TEST (X, Y, Z)
    VALUES (1,1,'B');
    INSERT INTO SQL_BUG_TEST (X, Y, Z)
    VALUES (1,2,'C');
    INSERT INTO SQL_BUG_TEST (X, Y, Z)
    VALUES (1,2,'D');
    DECLARE
    TYPE REC IS RECORD (
          x SQL_BUG_TEST.X%TYPE,
          y SQL_BUG_TEST.Y%TYPE,
          z SQL_BUG_TEST.Z%TYPE
    v_rec REC;
    BEGIN
          -- DISPLAY THE TABLE DATA
          BEGIN
                 DBMS_OUTPUT.PUT_LINE('TABLE DATA:');
                DBMS_OUTPUT.PUT_LINE('');
                 DBMS_OUTPUT.PUT_LINE('SELECT * FROM SQL_BUG_TEST ORDER BY X,Y,Z;');
                 FOR crs IN (SELECT *
                                     FROM SQL_BUG_TEST
                               ORDER BY X,Y,Z) LOOP
                    DBMS_OUTPUT.PUT_LINE(':'||crs.X||':'||crs.Y||':'||crs.Z);
                END LOOP;
          EXCEPTION WHEN OTHERS THEN
                 DBMS_OUTPUT.PUT_LINE(SQLERRM);       
          END;
          -- TEST 1
          -- returning result from MAX into a variable when the MAX is in the outer most select
          -- does not cause an error
          BEGIN
                 DBMS_OUTPUT.PUT_LINE('*****************************************************');
                 DBMS_OUTPUT.PUT_LINE('TEST 1');
                DBMS_OUTPUT.PUT_LINE('');
                 DBMS_OUTPUT.PUT_LINE('SELECT X, Y, MAX(Z) Z');
                DBMS_OUTPUT.PUT_LINE('FROM SQL_BUG_TEST');
                DBMS_OUTPUT.PUT_LINE('GROUP BY X,Y');
                FOR crs IN (SELECT X, Y, MAX(Z) Z
                                     FROM SQL_BUG_TEST
                               GROUP BY X, Y
                               ORDER BY X,Y,Z) LOOP
                     DBMS_OUTPUT.PUT_LINE(':'||crs.X||':'||crs.Y||':'||crs.Z);
                END LOOP;
          EXCEPTION WHEN OTHERS THEN
               DBMS_OUTPUT.PUT_LINE(SQLERRM);
          END;
          -- TEST 2
          -- returning MAX() from an inner select to an outer select and then into a variable
          -- causes an error
          BEGIN
                 DBMS_OUTPUT.PUT_LINE('*****************************************************');
                 DBMS_OUTPUT.PUT_LINE('TEST 2');
                DBMS_OUTPUT.PUT_LINE('THIS DID NOT CAUSE AN ERROR WITH ORACLE 9i');
                DBMS_OUTPUT.PUT_LINE('');
                 DBMS_OUTPUT.PUT_LINE('SELECT * INTO v_rec');
                DBMS_OUTPUT.PUT_LINE('FROM');
                DBMS_OUTPUT.PUT_LINE('(SELECT X, Y, MAX(Z) Z');
                DBMS_OUTPUT.PUT_LINE('FROM SQL_BUG_TEST');
                DBMS_OUTPUT.PUT_LINE('GROUP BY X,Y)');
                DBMS_OUTPUT.PUT_LINE('WHERE Y = 1');
                SELECT * INTO v_rec
                FROM
                (SELECT X, Y, MAX(Z) Z
                 FROM SQL_BUG_TEST
                 GROUP BY X, Y)
                WHERE Y = 1;
                DBMS_OUTPUT.PUT_LINE(':'||v_rec.X||':'||v_rec.Y||':'||v_rec.Z);
          EXCEPTION WHEN OTHERS THEN
               DBMS_OUTPUT.PUT_LINE(SQLERRM);
          END;
          -- TEST 3
          -- casting the result from MAX to char before returning to the outer select
          -- still causes an error
          BEGIN
                 DBMS_OUTPUT.PUT_LINE('*****************************************************');
                 DBMS_OUTPUT.PUT_LINE('TEST 3');
                DBMS_OUTPUT.PUT_LINE('');
                 DBMS_OUTPUT.PUT_LINE('SELECT * INTO v_rec');
                DBMS_OUTPUT.PUT_LINE('FROM');
                DBMS_OUTPUT.PUT_LINE('(SELECT X, Y, to_char(MAX(Z)) Z');
                DBMS_OUTPUT.PUT_LINE('FROM SQL_BUG_TEST');
                DBMS_OUTPUT.PUT_LINE('GROUP BY X,Y)');
                DBMS_OUTPUT.PUT_LINE('WHERE Y = 1');
                SELECT * INTO v_rec
                FROM
                (SELECT X, Y, to_char(MAX(Z)) Z
                 FROM SQL_BUG_TEST
                 GROUP BY X, Y)
                WHERE Y = 1;
                DBMS_OUTPUT.PUT_LINE(':'||v_rec.X||':'||v_rec.Y||':'||v_rec.Z);
          EXCEPTION WHEN OTHERS THEN
               DBMS_OUTPUT.PUT_LINE(SQLERRM);
          END;
          -- TEST 4 - SOLUTION
          -- the return value of MAX must be cast with to_char at the point where it is assigned to
          -- variable (outer most select)
          BEGIN
                 DBMS_OUTPUT.PUT_LINE('*****************************************************');
                 DBMS_OUTPUT.PUT_LINE('TEST 4 SOLUTION');
                DBMS_OUTPUT.PUT_LINE('');
                 DBMS_OUTPUT.PUT_LINE('SELECT X, Y, TO_CHAR(Z) Z INTO v_rec');
                DBMS_OUTPUT.PUT_LINE('FROM');
                DBMS_OUTPUT.PUT_LINE('(SELECT X, Y, MAX(Z) Z');
                DBMS_OUTPUT.PUT_LINE('FROM SQL_BUG_TEST');
                DBMS_OUTPUT.PUT_LINE('GROUP BY X,Y)');
                DBMS_OUTPUT.PUT_LINE('WHERE Y = 1');
                SELECT X, Y, TO_CHAR(Z) Z INTO v_rec
                FROM
                (SELECT X, Y, MAX(Z) Z
                 FROM SQL_BUG_TEST
                 GROUP BY X, Y)
                WHERE Y = 1;
                DBMS_OUTPUT.PUT_LINE(':'||v_rec.X||':'||v_rec.Y||':'||v_rec.Z);
          EXCEPTION WHEN OTHERS THEN
               DBMS_OUTPUT.PUT_LINE(SQLERRM);
          END;
    END;

    I certainly looks like a bug, but you should raise an iTAR on Metalink since Oracle does not monitor this forum.
    I was able to replicate your results on my 10.2.0.1 database.
    There is an easier workaround than yours. Try
    ALTER TABLE sql_bug_test MODIFY (z VARCHAR2(1));That seems to eliminate the problem on my instance.
    John

  • Bug?: Tabular Form function "addRow" can't handle multi-line Row Templates

    Hi all,
    i created a custom Report Template (Named Column Row Template) which creates 2 lines per Record (which in fact is 2 rows in a HTML table).
    In the APEX function initTabForm (apex_4_0.js) the sample row (f01_0000) is read and stored in gTabFormInitRow
    This is done by using a jQuery Selector like this: jQuery('#init_row_'+pRegionID) which returns only the first row of my multiline record.
    Is this behaviour intended or is it a bug? Or do i have to change my HTML structure?
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    Work: http://www.click-click.at
    Training: http://www.click-click.at/apex-4-0-workshops

    Hi Marc,
    thanks for the quick reply.
    I was afraid you would say it is intended behavior :-)
    A table per row has the disadvantage of loosing the automatic column width, i would have to set the column width to a fixed value to maintain a nice look.
    Well, thanks for the moment, i'll try to find a general solution and (if i succeed) get back to you.
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    Work: http://www.click-click.at
    Training: http://www.click-click.at/apex-4-0-workshops

  • Bug in "look up" functionality in textareas in safari

    The first word on a new line of a text area displays funny (highlights NOT where the word originally was) if you use the "look up" functionality (triple-click). See images below.
    Using safari 5.1.3 (7534.53.10) and OSX 10.7.3.

    hi rupesh,
    i would implement it like that:
    program a svc that is called from other services as request reply compoenent.
    svcLookup always gets all data or bits of data that a client (Use1, Use2) needs and replys the data to the requesting service. Use1 and 2 may cache results in case the db is down then the requests to Lookup would timeout.
    DB<------>svcLookup   <------>   svcUse1
                          <------>   svcUse2regards chris
    Edited by: cbrennsteiner on Sep 9, 2008 11:27 AM

  • Oracle 11g SUM function on the result of inner Select

    The inner Select returns rows with the values. The outer select running on tthe result of inner select SUM the result of the inner select.
    Although there are valid rows of the inner select the SUM in the outer SELECT return NVL. As a comment any aggregate function on the outer select returns NVL.
    The query is below.
    select a.yil,
    a.ay,
    sum(brut_prim),
    sum(kom),
    from (SELECT oid_pol_kesilen_acente,
    to_char(pp.zeyil_tanzim_tar, 'yyyy') yil,
    to_char(pp.zeyil_tanzim_tar, 'mm') ay,
    sum(decode(substr(pp.no, 1, 1),
    'T',
    pp.zeyil_brut_prim_fark / 2,
    pp.zeyil_brut_prim_fark)) -
    sum(pp.zeyil_gv_fark) brut_prim,
    sum(pp.zeyil_acente_kom_fark) kom
    from pol_police pp, org_acente oa
    WHERE SUBSTR(PP.NO, 1, 1) != 'D')
    group by oid_pol_kesilen_acente,
    to_char(pp.zeyil_tanzim_tar, 'yyyy'),
    to_char(pp.zeyil_tanzim_tar, 'mm')) a
    group by a.yil, a.ay, oid_pol_kesilen_acente
    Edited by: [email protected] on May 7, 2010 2:09 AM
    Edited by: [email protected] on May 7, 2010 2:31 AM

    Hi,
    please try the below sql:
    select a.yil, a.ay, sum(brut_prim), sum(kom),
    from (SELECT oid_pol_kesilen_acente,to_char(pp.zeyil_tanzim_tar, 'yyyy') yil, to_char(pp.zeyil_tanzim_tar, 'mm') ay,
    sum(decode(substr(pp.no, 1, 1), 'T',nvl(pp.zeyil_brut_prim_fark,0) / 2,nvl(pp.zeyil_brut_prim_fark,0))) - sum(nvl(pp.zeyil_gv_fark,0)) brut_prim,
    sum(nvl(pp.zeyil_acente_kom_fark,0)) kom
    from pol_police pp, org_acente oa
    WHERE SUBSTR(PP.NO, 1, 1) != 'D'
    group by oid_pol_kesilen_acente,
    to_char(pp.zeyil_tanzim_tar, 'yyyy'),
    to_char(pp.zeyil_tanzim_tar, 'mm')
    ) a
    group by a.yil, a.ay, oid_pol_kesilen_acente ;
    Thanks,
    Siva

  • OBIEE 11g Ago Function

    Hi All,
    I am using ago function in Answers it works fine
    But
    when observing the data, data is mismatched at particular Product category, why because two category s (A,B)   has same subcategory name (Basic)
    CAT       Sub Cat
    A  ------        Basic
    A  ------       Value Add
    A  ------       High
    B -------     Basic
    B ------       low
    B ------     medium
    My report has five columns like CM -1 , CM-2,CM-3,CM-4,CM-5 ,
    when i was selecting cat A and subcat is Basic, Data as below ....
    CM-1         CM-2     CM-3     CM -4    CM -5
    A basic   A basic  B basic B basic   A basic
    if sub cat name is different no issue
    Please help me.
    Regards
    Rm

    You can create a compound key of Cat + SubCat (concatenation in a logical column is a quick win) which will render the SubCats unique and assign that as the logical level key:
    SubCat:
    A-Basic
    A-Value Add
    A-High
    B-Basic

  • Is this a bug? (about analytic function)

    create table emp (
    empno varchar2(10),
    deptno varchar2(10),
    sal number(10)
    insert into emp(empno,deptno,sal) values('1','10',101);
    insert into emp(empno,deptno,sal) values('2','20',102);
    insert into emp(empno,deptno,sal) values('3','20',103);
    insert into emp(empno,deptno,sal) values('4','10',104);
    insert into emp(empno,deptno,sal) values('5','30',105);
    insert into emp(empno,deptno,sal) values('6','30',106);
    insert into emp(empno,deptno,sal) values('7','30',107);
    insert into emp(empno,deptno,sal) values('8','40',108);
    insert into emp(empno,deptno,sal) values('9','30',109);
    insert into emp(empno,deptno,sal) values('10','30',110);
    insert into emp(empno,deptno,sal) values('11','30',100);
    SELECT empno, deptno, sal,
    last_value(sal)
    OVER (PARTITION BY deptno order by sal desc) col1,
    first_value(sal)
    OVER (PARTITION BY deptno order by sal asc) col2,
    first_value(sal)
    OVER (PARTITION BY deptno order by sal desc) col3,
    last_value(sal)
    OVER (PARTITION BY deptno order by sal asc) col4
    FROM emp
    col2, col3 return what I expect.
    I don't know why col1 and col4 return the these kinds of results.

    Well... I learned something new today!
    This is because you have not defined a windowing clause in your analytic query. If you do not specify a windowing clause, the default used is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW. So your query is equivalent to:
      1  select empno, deptno, sal,
      2  last_value(sal) over (
      3     partition by deptno
      4     order by sal desc
      5     range between unbounded preceding and current row
      6  ) col1,
      7  first_value(sal) over (
      8     partition by deptno
      9     order by sal asc
    10     range between unbounded preceding and current row
    11  ) col2,
    12  first_value(sal) over (
    13     partition by deptno
    14     order by sal desc
    15     range between unbounded preceding and current row
    16  ) col3,
    17  last_value(sal) over (
    18     partition by deptno
    19     order by sal asc
    20     range between unbounded preceding and current row
    21  ) col4
    22* from emp
    SQL> /
         EMPNO     DEPTNO        SAL       COL1       COL2       COL3       COL4
             4         10        104        104        101        104        104
             1         10        101        101        101        104        101
             3         20        103        103        102        103        103
             2         20        102        102        102        103        102
            10         30        110        110        100        110        110
             9         30        109        109        100        110        109
             7         30        107        107        100        110        107
             6         30        106        106        100        110        106
             5         30        105        105        100        110        105
            11         30        100        100        100        110        100
            11         30        100        100        100        110        100
             8         40        108        108        108        108        108
    12 rows selected.What you need to do is specify the correct windowing clause as follows:
      1  select empno, deptno, sal,
      2  last_value(sal) over (
      3     partition by deptno
      4     order by sal desc
      5     range between unbounded preceding and unbounded following
      6  ) col1,
      7  first_value(sal) over (
      8     partition by deptno
      9     order by sal asc
    10  ) col2,
    11  first_value(sal) over (
    12     partition by deptno
    13     order by sal desc
    14  ) col3,
    15  last_value(sal) over (
    16     partition by deptno
    17     order by sal asc
    18     range between unbounded preceding and unbounded following
    19  ) col4
    20* from emp
    SQL> /
         EMPNO     DEPTNO        SAL       COL1       COL2       COL3       COL4
             4         10        104        101        101        104        104
             1         10        101        101        101        104        104
             3         20        103        102        102        103        103
             2         20        102        102        102        103        103
            10         30        110        100        100        110        110
             9         30        109        100        100        110        110
             7         30        107        100        100        110        110
             6         30        106        100        100        110        110
             5         30        105        100        100        110        110
            11         30        100        100        100        110        110
            11         30        100        100        100        110        110
             8         40        108        108        108        108        108
    12 rows selected....which gives the expected results. Or just use max(), which is clearer anyway :)
    This is documented on Metalink, bug number 5684819:
    "If you omit the windowing_clause of the analytic_clause, it defaults to RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW. This default will return a value that sometimes may seem unexpected, because the last value in the window is at the bottom of the window, which is not fixed. It keeps changing as the current row changes. For expected results, specify the windowing clause as RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING. Another option, is to specify the windowing clause as RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING."
    cheers,
    Anthony

Maybe you are looking for