SQL Challenge - Returning count=0 for non-existing values

Hello there,
I have a question about our requirement and an SQL query. I have posted this to some email groups but got no answer yet.
Here is the test case:
SQL> conn ...
Connected.
-- create the pattern table and populate
SQL> create table pattern(id number, keydescription varchar2(50));
Table created.
SQL> insert into pattern values(1,'hata1');
1 row created.
SQL> insert into pattern values(2,'hata2');
1 row created.
SQL> insert into pattern values(3,'hata3');
1 row created.
SQL> insert into pattern values(4,'hata4');
1 row created.
SQL> insert into pattern values(5,'hata5');
1 row created.
SQL> select * from pattern;
ID KEYDESCRIPTION
1 hata1
2 hata2
3 hata3
4 hata4
5 hata5
SQL> commit;
Commit complete.
-- create the messagetrack and populate
SQL> create table messagetrack(pattern_id number, realdate date);
Table created.
SQL> insert into messagetrack values(1,to_date('26/08/2007 13:00:00','dd/mm/yyyy hh24:MI:ss'));
1 row created.
SQL> insert into messagetrack values(1,to_date('26/08/2007 13:05:00','dd/mm/yyyy hh24:MI:ss'));
1 row created.
SQL> insert into messagetrack values(2,to_date('26/08/2007 13:15:00','dd/mm/yyyy hh24:MI:ss'));
1 row created.
SQL> insert into messagetrack values(3,to_date('26/08/2007 14:15:00','dd/mm/yyyy hh24:MI:ss'));
1 row created.
SQL> insert into messagetrack values(4,to_date('26/08/2007 15:15:00','dd/mm/yyyy hh24:MI:ss'));
1 row created.
SQL> insert into messagetrack values(1,to_date('26/08/2007 15:15:00','dd/mm/yyyy hh24:MI:ss'));
1 row created.
SQL> commit;
Commit complete.
SQL> select * from messagetrack;
PATTERN_ID REALDATE
1 26-AUG-07
1 26-AUG-07
2 26-AUG-07
3 26-AUG-07
4 26-AUG-07
1 26-AUG-07
6 rows selected.
Now, we have this simple query:
SQL> select p.KeyDescription as rptBase , to_char( mt.realdate,'dd') as P1 , to_char(mt.realdate,'HH24') as P2, count(*) as countX
2 from messageTrack mt, Pattern p
3 Where mt.realDate >= to_date('26/08/2007 13:00:00','dd/MM/yyyy hh24:MI:ss')
4 and mt.realDate <= to_date('27/08/2007 20:00:00','dd/MM/yyyy hh24:MI:ss')
5 and mt.pattern_id=p.id
6 group by p.KeyDescription, to_char(mt.realdate,'dd'), to_char( mt.realdate,'HH24')
7 order by p.KeyDescription, to_char(mt.realdate,'dd'), to_char(mt.realdate,'HH24');
RPTBASE P1 P2 COUNTX
hata1 26 13 2
hata1 26 15 1
hata2 26 13 1
hata3 26 14 1
hata4 26 15 1
But the result we need should contain the pattern values(hata1, hata2, hata3 and hata4) for each time interval(hour) although there are might be no records of some patterns for some hours.
The result for our test case should look like this:
RPTBASE P1 P2 COUNTX
hata1 26 13 2
hata1 26 14 0
hata1 26 15 0
hata2 26 13 1
hata2 26 14 0
hata2 26 15 0
hata3 26 13 0
hata3 26 14 1
hata3 26 15 0
hata4 26 13 0
hata4 26 14 0
hata4 26 15 1
Our version is 10.2.0.2
On my discussions some said model clause may be used, but i don't know model clause much and can't imagine how to use.
You can download the test case code above to reproduce from:
http://www.bhatipoglu.com/files/query1.txt
You can see the output above more clearly(monospace font) on:
http://www.bhatipoglu.com/files/query1_output.txt
Additionally, I want to state that, in the resulting table, we don't want all the patterns(hata1, hata2, hata3, hata4 and hata5). We just want the ones that exists on messageTrack table(hata1, hata2, hata3 and hata4) as you see on the result.
Thanks in advance.

Here is an attempt with the Model Clause:
Edit: I should mention that I created a view out of your original query.
SELECT rptbase
      ,day
      ,hour
      ,countx
FROM demoV
  MODEL
    DIMENSION BY (rptbase, day, hour)
    MEASURES (countx)
      RULES(countx[
                    FOR rptbase IN (SELECT rptbase
                                    FROM demoV)
                    ,FOR day IN   (SELECT day
                                    FROM demoV)
                    ,FOR hour FROM 13 to 15 INCREMENT 1
                    ] =
                    NVL(countx[CV(rptbase),CV(day),CV(hour)],0)
            order by 1,2,3;Which produces the following
RPTBASE                                    DAY                 HOUR               COUNTX                
hata1                                              26                     13                     2                     
hata1                                              26                     14                     0                     
hata1                                              26                     15                     1                     
hata2                                              26                     13                     1                     
hata2                                              26                     14                     0                     
hata2                                              26                     15                     0                     
hata3                                              26                     13                     0                     
hata3                                              26                     14                     1                     
hata3                                              26                     15                     0                     
hata4                                              26                     13                     0                     
hata4                                              26                     14                     0                     
hata4                                              26                     15                     1               Note my Hata1 26 15 has a countx of 1 (I believe that this is correct and that your sample result is incorrect, if this is not the case, please explain why it should be 0)
Message was edited by:
JS1

Similar Messages

  • Application hangs for non existing value

    Hi,
    At the DB level I tried to query non existing value from the table, query came out with "no rows selected" . But when I try to do the same from front end, application hangs! I just checked in the statspack report it shows like query is taking more cpu time to execute. what could be the reason for this?
    when I join the v$session,v$sql to get the currently running query on database, it shows the query which try to execute from the application as active.
    why it is hanging in application and why not in DB?
    can any one brief me on this regard? why does application hangs for non exsting value?
    With Regards
    Boo

    Hi,
    At the DB level I tried to query non existing value from the table, query came out with "no rows selected" . But when I try to do the same from front end, application hangs! I just checked in the statspack report it shows like query is taking more cpu time to execute. what could be the reason for this?
    when I join the v$session,v$sql to get the currently running query on database, it shows the query which try to execute from the application as active.
    why it is hanging in application and why not in DB?
    can any one brief me on this regard? why does application hangs for non exsting value?
    With Regards
    Boo

  • Selectivity for non-pupular value in Height based Histograms.

    Hi,
    I wanted to check how optimizer calculates the cardinality/selectivity for a value which is not popular and histogram is height based histograms.
    Following is the small test case (Version is 11.2.0.1) platform hpux
    create table t1 (
           skew    not null,
           padding
    as
    /* with generator as (
    select --+ materialize
           rownum id
    from all_objects
    where rownum <= 5000
    select /*+ ordered use_nl(v2) */
         v1.id,
         rpad('x',400)
    from
        generator  v1,
        generator v2
    where
       v1.id <= 80
    and
       v2.id <= 80
    and
       v2.id <= v1.id
    ;Following is the table stats:
    SQL> select count(*) from t1;
      COUNT(*)
          3240
    SQL> exec dbms_stats.gather_table_stats('SYS','T1',cascade=>TRUE, estimate_percent => null, method_opt => 'for all columns size 75');
    PL/SQL procedure successfully completed.
    SQL> select column_name,num_distinct,density,num_buckets from dba_tab_columns where table_name='T1';
    COLUMN_NAME                    NUM_DISTINCT    DENSITY NUM_BUCKETS
    SKEW                                     80 .013973812          75
    PADDING                                   1 .000154321           1
    SQL> select endpoint_number, endpoint_value from dba_tab_histograms where column_name='SKEW' and table_name='T1' order by endpoint_number;
    ENDPOINT_NUMBER ENDPOINT_VALUE
                  0              1
                  1              9
                  2             13
                  3             16
                  4             19
                  5             21
                  6             23
                  7             25
                  8             26
                  9             28
                 10             29
    ENDPOINT_NUMBER ENDPOINT_VALUE
                 11             31
                 12             32
                 13             33
                 14             35
                 15             36
                 16             37
                 17             38
                 18             39
                 19             40
                 20             41
                 21             42
    ENDPOINT_NUMBER ENDPOINT_VALUE
                 22             43
                 23             44
                 24             45
                 25             46
                 26             47
                 27             48
                 28             49
                 29             50
                 30             51
                 32             52
                 33             53
    ENDPOINT_NUMBER ENDPOINT_VALUE
                 34             54
                 35             55
                 37             56
                 38             57
                 39             58
                 41             59
                 42             60
                 43             61
                 45             62
                 46             63
                 48             64
    ENDPOINT_NUMBER ENDPOINT_VALUE
                 49             65
                 51             66
                 52             67
                 54             68
                 56             69
                 57             70
                 59             71
                 60             72
                 62             73
                 64             74
                 66             75
    ENDPOINT_NUMBER ENDPOINT_VALUE
                 67             76
                 69             77
                 71             78
                 73             79
                 75             80
    60 rows selected.Checking the selectivity for value 75(which is the popular value as per information from dba_tab_histograms
    SQL> set autotrace on
    SQL> select count(*) from t1 where skew=75;
      COUNT(*)
            75
    Execution Plan
    Plan hash value: 4273422929
    | Id  | Operation         | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |       |     1 |     3 |     1   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE   |       |     1 |     3 |            |          |
    |*  2 |   INDEX RANGE SCAN| T1_I1 |    86 |   258 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("SKEW"=75)Skipped the Statistics information for keep example short.
    selectivity for 75 (popular value) = 2/75 = 0.02666
    Cardinality for 75 is = selectivity * num_rows = 0.02666*3240 = 86.3784 (rounded to 86) >> Here selectivity and cardinality are correct and displayed in autotrace.
    SQL> select count(*) from t1 where skew=8;
      COUNT(*)
             8
    Execution Plan
    Plan hash value: 4273422929
    | Id  | Operation         | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |       |     1 |     3 |     1   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE   |       |     1 |     3 |            |          |
    |*  2 |   INDEX RANGE SCAN| T1_I1 |    29 |    87 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("SKEW"=8)how the cardinality is 29 calculated. I think the formula for selectivity is
    select for 1(non popular value) = density * num_rows = .013973812 * num_rows (which is 45 approx) but in autotrace its 29
    SQL> select count(*) from t1 where skew = 46;
      COUNT(*)
            46
    Execution Plan
    Plan hash value: 4273422929
    | Id  | Operation         | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |       |     1 |     3 |     1   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE   |       |     1 |     3 |            |          |
    |*  2 |   INDEX RANGE SCAN| T1_I1 |    29 |    87 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("SKEW"=46)46 is also non popular value
    So how the value is calculated for these values?

    Your example seems to be based on Jonathan Lewis's article:
    http://jonathanlewis.wordpress.com/2012/01/03/newdensity/
    In this article, he does walk through the calculation of selectivity for non-popular values.
    The calculation is not density but NewDensity, as seen in a 10053 trace, which takes into account the number of non-popular values AND the number of non-popular buckets
    The article describes exactly how 29 is derived.Hi Dom,
    Yes i used the same sample script of create the data sets. I should have checked Jonathan's blog for new density calculations. So selectivity works out as two either ways
    1) selectivity(non popular) = Newdensity(took from 10053 traces) * rum_rows
    or
    2) non-popular rows/ non_popular values (where non-popular values can be derived from 10053 traces and non popular rows are (3240 * (74-31)/74 = ) 1883
    Thanks for pointing to right blog

  • "initial non-cumulative for non-cumulative values"  is not available in DTP (0AFMM_C02)

    Hi Experts,
    We are working for BI implementation for AFS Industry,
    when we are working on AFS specific inventory cube 0AFMM_C02 , we are facing stock mismatch problem
    for AFS Stock initialization we are using the data source 2LIS_AF_STOCK_INITALIZATION instead of 2LIS_03_BX, this data source is specificly designed for AFS
    when we are extracting the data using 2LIS_AF_STOCK_INITALIZATION for stock initialization and
    2LIS_03_BF data source to load the Moments.
    we compressed cube with Marker update for 2LIS_AF_STOCK_INITALIZATION data load(by deselecting the No marker update check box)
    we compressed cube with No Marker update for 2LIS_03_BF historical data load(by selecting the No marker update check box)
    we compressed cube with Marker update for 2LIS_03_BF Delta data load(by deselecting the No marker update check box)
    Now we are facing stock mistach problem, we found reason for this
    "initial non-cumulative for non-cumulative values" option is not available in DTP only Delta & Full options are available
    and infopackage of  2LIS_AF_STOCK_INITALIZATION data source also has "Full update" instead of "Generate Intial Status"
    Please let us know how can we get the "initial non-cumulative for non-cumulative values" option in the DTP level.
    Regards,
    Chandra

    Hi Chandrakumar,
    We are facing the same problem, how do you solve it?
    Regards,

  • Bing based federated result sources not returning any results for non-English languages

    I have a result source with this query:
    http://www.bing.com/search?q={?searchterms}  language:fr site:msdn.microsoft.com&format=rss&count=50&first={startIndex}
    This used to give me 40-50 results for common terms like download, blog etc.
    From today (7/14) IST, this source does not return any results. There are no results if I execute this query directly in IE either.
    Same behavior observed for: language:es, language:de etc.
    I do however get results as expected for language:en.
    Any idea what the issue might be?

    Hi Swapnil,
    According to your description, my understanding is that no results returned when searching with non-English in the Result Source query.
    I tested the same scenario per your post and I got the same results as you got.
    I recommend to change the language:fr in the Result Source query to be lang=fr to see if the issue still occurs.
    More references:
    http://kbdump.com/sharepoint-2013-opensearch-search-twitter-facebook-wikipedia-page/
    http://richardstk.com/2013/11/08/sharepoint-2013-federated-search-to-bing/
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • CS3 Installer asks for non-existent DVD drive

    I'm running CS3 on Windows XP. I need to reinstall because I somehow lost codecs for Premiere Pro. Whenever I try to reinstall, the CS3 installer puts up an Installer Alert that asks me to insert CS3 Master Collection Disc 1 into drive G:\ to continue installation.
    That sounds pretty simple, but there is no G: drive on my computer. My two DVD drives are D: and E:, and inserting the disc there has no effect. Checking the Windows device manager shows no G: device recognized anywhere on the computer.
    I can only click OK, which returns the same alert, or Cancel to cancel the installation. I cannot, for the life of me, figure out how to get the CS3 installer to ask for installation disks on an existing drive. What's particularly annoying is that the installer is running from a DVD in drive E:, so you'd think it would know to ask for further discs in drive E:. I've tried it as well from drive D:.
    Any ideas for getting the installer to stop asking for discs in a non-existent drive?
    I've toyed with the idea of completely uninstalling CS3, but am afraid that the installer still won't work, in which case I won't be able to get any work done using CS3 at all.
    Thanks for any and all help,
    Mike Boom

    The 404 means you have not followed the Very Important Instructions on the prodesigntools page before clicking the download links.
    The 7 steps are crucial for setting the correct cookies on your hard drive so that the Adobe servers will grant you access to the download files when you click the links.
    So:
    Go back to http://prodesigntools.com/download-adobe-cs4-and-cs3-free-trials-here.html
    Follow the Very Important Instructions (Step 0 to Step 6 = 7 Steps)
    Then click the download links and they will work.

  • More Lion issues - Throwing Console errors for non-existent application

    Again, with the bad side of Lion.
    I was receiving all kinds of console errors in Lion with TweetDeck and Adobe AIR apps so I de-installed these applications and removed them from the system. However, Apple's fantastic Lion Operating System still is complaining about them even though they are not to be found.
    In the console I am getting sandbox errors on locations and files that are non-existent. Below is a snapshot of the error messages, and the directory referred to:  /Users/kkathman/Library/Application Support/Adobe/AIR/ELS/TweetDeckFast....  and the others DON'T EVEN EXIST!!
    How do I keep this from happening?  Why does the OS go after this when it's been removed?????
    8/20/11SaturdayAugust 5:30:14.113 PM    mdworker32    kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
    8/20/11SaturdayAugust 5:31:11.000 PM    kernel    nstat_lookup_entry failed: 2
    8/20/11SaturdayAugust 5:31:44.239 PM    com.apple.SecurityServer    Session 100071 created
    8/20/11SaturdayAugust 5:31:44.254 PM    com.apple.security.XPCKeychainSandboxCheck    Can't get sandbox fs extension for /Users/kkathman/Library/Application Support/Adobe/AIR/ELS/TweetDeckFast.F9107117265DB7542C1A806C8DB837742CE14C21.1/ PrivateEncryptedDatak, status=-1 errno=No such file or directory ext=(null)
    8/20/11SaturdayAugust 5:31:44.254 PM    com.apple.security.XPCKeychainSandboxCheck    Can't get sandbox fs extension for /Users/kkathman/Library/Application Support/Adobe/AIR/ELS/TweetDeckFast.F9107117265DB7542C1A806C8DB837742CE14C21.1/ lck~PrivateEncryptedDatak, status=-1 errno=No such file or directory ext=(null)
    8/20/11SaturdayAugust 5:31:44.254 PM    com.apple.security.XPCKeychainSandboxCheck    Can't get sandbox fs extension for /Users/kkathman/Library/Application Support/Adobe/AIR/ELS/TweetDeckFast.F9107117265DB7542C1A806C8DB837742CE14C21.1/ .fl89CB8354, status=-1 errno=No such file or directory ext=(null)
    8/20/11SaturdayAugust 5:31:44.255 PM    com.apple.security.XPCKeychainSandboxCheck    Can't get sandbox fs extension for /Users/kkathman/Library/Application Support/Adobe/AIR/ELS/com.seesmic.desktop.client.D89F32799270693BEF34AAA36E9B26 32B59240FA.1/PrivateEncryptedDatak, status=-1 errno=No such file or directory ext=(null)
    8/20/11SaturdayAugust 5:31:44.255 PM    com.apple.security.XPCKeychainSandboxCheck    Can't get sandbox fs extension for /Users/kkathman/Library/Application Support/Adobe/AIR/ELS/com.seesmic.desktop.client.D89F32799270693BEF34AAA36E9B26 32B59240FA.1/lck~PrivateEncryptedDatak, status=-1 errno=No such file or directory ext=(null)
    8/20/11SaturdayAugust 5:31:44.255 PM    com.apple.security.XPCKeychainSandboxCheck    Can't get sandbox fs extension for /Users/kkathman/Library/Application Support/Adobe/AIR/ELS/com.seesmic.desktop.client.D89F32799270693BEF34AAA36E9B26 32B59240FA.1/.fl89CB8354, status=-1 errno=No such file or directory ext=(null)
    8/20/11SaturdayAugust 5:31:44.255 PM    com.apple.security.XPCKeychainSandboxCheck    Can't get sandbox fs extension for /Users/kkathman/Library/Application Support/Adobe/AIR/ELS/TweetDeckFast.FFF259DC0CE2657847BBB4AFF0E62062EFC56543.1/ PrivateEncryptedDatak, status=-1 errno=No such file or directory ext=(null)
    8/20/11SaturdayAugust 5:31:44.255 PM    com.apple.security.XPCKeychainSandboxCheck    Can't get sandbox fs extension for /Users/kkathman/Library/Application Support/Adobe/AIR/ELS/TweetDeckFast.FFF259DC0CE2657847BBB4AFF0E62062EFC56543.1/ lck~PrivateEncryptedDatak, status=-1 errno=No such file or directory ext=(null)
    8/20/11SaturdayAugust 5:31:44.255 PM    com.apple.security.XPCKeychainSandboxCheck    Can't get sandbox fs extension for /Users/kkathman/Library/Application Support/Adobe/AIR/ELS/TweetDeckFast.FFF259DC0CE2657847BBB4AFF0E62062EFC56543.1/ .fl89CB8354, status=-1 errno=No such file or directory ext=(null)
    8/20/11SaturdayAugust 5:32:01.234 PM    Preview    snapshot of document took: 0.00030899 secs, calling unblockUserInteraction
    8/20/11SaturdayAugust 5:32:01.318 PM    Preview    writing of document took: 0.083616 secs, success = YES
    8/20/11SaturdayAugust 5:32:42.333 PM    rpcsvchost    sandbox_init: com.apple.msrpc.netlogon.sb succeeded
    8/20/11SaturdayAugust 5:32:42.483 PM    sandboxd    ([66316]) smbd(66316) deny job-creation
    8/20/11SaturdayAugust 5:32:42.583 PM    rpcsvchost    sandbox_init: com.apple.msrpc.srvsvc.sb succeeded
    8/20/11SaturdayAugust 5:32:42.609 PM    smbd    anonymous connected to path /var/rpc/ncacn_np
    8/20/11SaturdayAugust 5:32:53.587 PM    sandboxd    ([66320]) rpcsvchost(66320) deny mach-lookup com.apple.distributed_notifications@1v3
    8/20/11SaturdayAugust 5:34:53.329 PM    smbd    anonymous connected to path /var/rpc/ncacn_np
    8/20/11SaturdayAugust 5:39:32.429 PM    mdworker32    kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.

    Don't know how you de-installed but you didn't fully uninstall them. If you did not have an uninstaller supplied with the applications, then here's what you need to consider in order to fully uninstall:
    Uninstalling Software: The Basics
    Most OS X applications are completely self-contained "packages" that can be uninstalled by simply dragging the application to the Trash.  Applications may create preference files that are stored in the /Home/Library/Preferences/ folder.  Although they do nothing once you delete the associated application, they do take up some disk space.  If you want you can look for them in the above location and delete them, too.
    Some applications may install an uninstaller program that can be used to remove the application.  In some cases the uninstaller may be part of the application's installer, and is invoked by clicking on a Customize button that will appear during the install process.
    Some applications may install components in the /Home/Library/Applications Support/ folder.  You can also check there to see if the application has created a folder.  You can also delete the folder that's in the Applications Support folder.  Again, they don't do anything but take up disk space once the application is trashed.
    Some applications may install a startupitem or a Log In item.  Startupitems are usually installed in the /Library/StartupItems/ folder and less often in the /Home/Library/StartupItems/ folder.  Log In Items are set in the Accounts preferences.  Open System Preferences, click on the Accounts icon, then click on the LogIn Items tab.  Locate the item in the list for the application you want to remove and click on the "-" button to delete it from the list.
    Some software use startup daemons or agents that are a new feature of the OS.  Look for them in /Library/LaunchAgents/ and /Library/LaunchDaemons/ or in /Home/Library/LaunchAgents/.
    If an application installs any other files the best way to track them down is to do a Finder search using the application name or the developer name as the search term.  Unfortunately Spotlight will not look in certain folders by default.  You can modify Spotlight's behavior or use a third-party search utility, Easy Find, instead.  Download Easy Find at VersionTracker or MacUpdate.
    Some applications install a receipt in the /Library/Receipts/ folder.  Usually with the same name as the program or the developer.  The item generally has a ".pkg" extension.  Be sure you also delete this item as some programs use it to determine if it's already installed.
    There are many utilities that can uninstall applications.  Here is a selection:
    AppZapper
    Automaton
    Hazel
    CleanApp
    Yank
    SuperPop
    Uninstaller
    Spring Cleaning
    Look for them at VersionTracker or MacUpdate.
    For more information visit The XLab FAQs and read the FAQ on removing software.

  • Java.sql.Statement.setFetchSize(int) option for non-scrollable result sets

    Hello!
    Our tests indicate that fetch size option mentioned makes visible difference in performance for non-scrollable result sets also. In the same time, it seems there is no way to set this option for such result sets at TopLink level, and default fetch size is always used instead.
    Can somebody propose a solution for this, I mean a way to specify custom fetch size (for results without any scrolling)?
    Thanks,
    Sergey

    To set the JDBC fetch size for a query, use the following APIs:
    int desiredFetchSize = 500;
    ReadAllQuery query = new ReadAllQuery(YourClass.class);
    CallQueryMechanism queryMechanism =
    (CallQueryMechanism) query.getQueryMechanism();
    DatabaseCall call = queryMechanism.getCall();
    call.setResultSetFetchSize(desiredFetchSize);
    If you wish to set the fetch size for all queries, consider using named queries for all queries (see the TopLink documentation for more information on named queries), and then configure them on startup.
    Information taking from Metalink Note:237093.1

  • How to find average for non blank values

    I need to calculate avarage for each restricted key figures. There are some blank values in this restricted key figures. Now I need to sumup and divide by non blank count. Do you know how to do it? How to count non blnak values and find avereage.
    Thanks,
    Phani

    In the properties of Key figure used in column/row, Calculations section, you can maintain calculation type for result as well as single value. There is "Average of all values not equal 0" option is available.
    Rgds,
    Vikram.
    Edited by: Vikram Kate on May 22, 2008 11:23 AM

  • How to load init for non cumulative values?

    Hi folks,
    anyone here, who can tell me how to load initial amounts from DSO to non cumulative values in InfoCubes?
    I found only poor documentation about this.
    Thanks!

    hi Timo
    you load initial of load as you do in the normal case only thing you have to keep in mind that before loading opening balance you have to UNCLICK  NO MARKER UPDATE from the infocube and compress the request ASAP as it will greatly effect your query performance.
    sanjeev

  • Inserting the default value for non existing date

    hello,
    i am designing a matrix report for payslip for month wise in oracle 6i report builder.
    in that i want to display per day working hours of the month.
    i m using following query for achieving my goal :
    select a.paycode,b.empname,c.departmentname,to_char(a.dateoffice,'DD') dateoffice,a.shiftattended,round(decode(a.hw,0,a.mannual_hours,a.hw),0) hw,
    a.ISMANNUAL,A.STATUS
    from tbltimeregister1 a,
         tblemployee  b,
          tbldepartment c
    where a.paycode=b.paycode and
    (a.hw >0 or a.mannual_hours is not null ) and
    a.departmentcode='D05' AND
    a.departmentcode=c.departmentcode and
    a.dateoffice between to_date('01/12/2012','dd/mm/yyyy') and to_date('31/12/2012','dd/mm/yyyy')
    ORDER BY A.PAYCODE,A.DATEOFFICEit is displaying the hours for the date in b/w date ranges exist in master table.
    my problem is that if any date of a month is not in master data ,it should display the given date in DD format with 0 hours , A(absent) status, and null shift by default.
    pl tell me how to modify my query for getting my desirable result.
    Thanking You
    Regards
    Vishal Agrawal

    965354 wrote:
    hello,
    select a.paycode,b.empname,c.departmentname,to_char(a.dateoffice,'DD') dateoffice,a.shiftattended,round(decode(a.hw,0,a.mannual_hours,a.hw),0) hw,
    a.ISMANNUAL,A.STATUS
    from tbltimeregister1 a,
    tblemployee  b,
          tbldepartment c
    where a.paycode=b.paycode and
    (a.hw >0 or a.mannual_hours is not null ) and
    a.departmentcode='D05' AND
    a.departmentcode=c.departmentcode and
    a.dateoffice between to_date('01/12/2012','dd/mm/yyyy') and to_date('31/12/2012','dd/mm/yyyy')
    ORDER BY A.PAYCODE,A.DATEOFFICEit is displaying the hours for the date in b/w date ranges exist in master table.
    my problem is that if any date of a month is not in master data ,it should display the given date in DD format with 0 hours , A(absent) status, and null shift by default.
    pl tell me how to modify my query for getting my desirable result.Your problem isn't exactly clear to me. How do you pass the dates to be compared to the DateOffice column? It will be better to ensure the Master table contain data for each date (with some default values) and you will not have to tweak your sql.
    Below is a possible solution:
    select *
      from
    select a.paycode,b.empname,c.departmentname,to_char(a.dateoffice,'DD') dateoffice,a.shiftattended,round(decode(a.hw,0,a.mannual_hours,a.hw),0) hw,
    a.ISMANNUAL,A.STATUS
    from tbltimeregister1 a,
         tblemployee  b,
          tbldepartment c
    where a.paycode=b.paycode and
    (a.hw >0 or a.mannual_hours is not null ) and
    a.departmentcode='D05' AND
    a.departmentcode=c.departmentcode and
    a.dateoffice between to_date('01/12/2012','dd/mm/yyyy') and to_date('31/12/2012','dd/mm/yyyy')
    union
    select a.paycode,b.empname,c.departmentname,to_char(&date_variable,'DD') dateoffice,null,round(decode(a.hw,0,a.mannual_hours,a.hw),0) hw,
    a.ISMANNUAL,'A'
    from tbltimeregister1 a,
         tblemployee  b,
          tbldepartment c
    where a.paycode=b.paycode and
    (a.hw >0 or a.mannual_hours is not null ) and
    a.departmentcode='D05' AND
    a.departmentcode=c.departmentcode and
    ORDER BY A.PAYCODE,A.DATEOFFICEIf this is not what you are looking for, then
    1. Post a script that helps us to create the Tables required in your query
    2. Some sample data. That includes the data for master table that has missing dates (4-5 rows should suffice)
    3. The expected results from the sample data you posted.
    Please do not forget to mention your version:
    select * from v$version;

  • UpdateXML for non-existing attribute

    Hello
    bellow are data for a sreange looking (for me) behaviour of updateXML.
    Usually (i mean other languages) setting an xml node attribute causes attribute creation if it does not exist.
    Here obviously that is not the case.
    Q: Why and is it possible to create attribute during node update?
    thank you
    i
    h3. general info
    SQL&gt; select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
    PL/SQL Release 9.2.0.7.0 - Production
    CORE 9.2.0.7.0 Production
    TNS for 32-bit Windows: Version 9.2.0.7.0 - Production
    NLSRTL Version 9.2.0.7.0 - Production
    SQL&gt; select dbms_metadata.get_DDL('TABLE', 'X') FROM dual;
    DBMS_METADATA.GET_DDL('TABLE',
    CREATE TABLE "PCB_1209"."X"
    ( "NODE" "SYS"."XMLTYPE"
    ) PCTFREE 10
    SQL&gt;
    SQL&gt; insert into x values(Xmltype('&lt;TOP&gt;&lt;DATAID&gt;111080&lt;/DATAID&gt;&lt;/TOP&gt;'));
    SQL&gt; insert into x values(Xmltype('&lt;TOP&gt;&lt;DATAID lbl="test"&gt;111000&lt;/DATAID&gt;&lt;/TOP&gt;'));
    SQL&gt; commit;
    Commit complete
    h3. correct part
    SQL&gt;
    SQL&gt; select extract(node, '/').getStringVal() as node
    2 from x where extract(node, '//DATAID/text()').getNumberVal() = 111000;
    NODE
    &lt;TOP&gt;
    &lt;DATAID lbl="test"&gt;111000&lt;/DATAID&gt;
    &lt;/TOP&gt;
    SQL&gt;
    SQL&gt; update x set node = updateXML(node,'//DATAID/@lbl','test_new')
    2 where extract(node, '//DATAID/text()').getNumberVal() = 111000;
    1 row updated
    SQL&gt; commit;
    Commit complete
    SQL&gt;
    SQL&gt; select extract(node, '/').getStringVal() as node
    2 from x where extract(node, '//DATAID/text()').getNumberVal() = 111000;
    NODE
    &lt;TOP&gt;
    &lt;DATAID lbl="test_new"&gt;111000&lt;/DATAID&gt;
    &lt;/TOP&gt;
    h3. wrong part
    SQL&gt;
    SQL&gt; select extract(node, '/').getStringVal() as node
    2 from x where extract(node, '//DATAID/text()').getNumberVal() = 111080;
    NODE
    &lt;TOP&gt;
    &lt;DATAID&gt;111080&lt;/DATAID&gt;
    &lt;/TOP&gt;
    SQL&gt;
    SQL&gt; update x set node = updateXML(node,'//DATAID/@lbl','test_new')
    2 where extract(node, '//DATAID/text()').getNumberVal() = 111080;
    1 row updated
    SQL&gt; commit;
    Commit complete
    SQL&gt;
    SQL&gt; select extract(node, '/').getStringVal() as node
    2 from x where extract(node, '//DATAID/text()').getNumberVal() = 111080;
    NODE
    &lt;TOP&gt;
    &lt;DATAID&gt;111080&lt;/DATAID&gt;
    &lt;/TOP&gt;

    Unusual, probably. Documented, yes. This is from 10.2 but would still be applicable to you and your situation.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14214/chapter1.htm#FEATURENO05479
    The current UpdateXML() function can only manipulate the content of existing nodes within an XML document. It cannot be used to add or remove nodes from a document. The only way to add or remove nodes from a document is to use the methods provided by the DOM API.So you are going to have to insert/create that attribute in the XML before you can update it. I was going to provide a link to some examples but I can't seem to recall where I saw them in the forums. I thought it was on {forum:id=75} but I can't find it now.

  • Each Airport device asking for non-existant password

    My network consists of 2 AEBS and 2 AEs. There is no network password at the moment.
    I just opened up Airport Utility to check a setting and when I double clicked on my main AEBS it asked for a password. I checked every device. They are all asking for a password which doesn't exist, before allowing me to even see the configurations. This happened before with an AE that I was trying to reset, the only way around it was to hook the AE to my mac with ethernet. I really don't want to have to do that every time I want to make a change to my network. Anyone know what's going on here? The same thing happens if I click on Manual Setup or Continue.

    I live on a dirt road with very few neighbors. I would notice if someone parked on the road
    in front of my house. Plus, why would anyone want to change the settings on my airport?
    Also, the passwords it was asking for were not the passwords I had assigned to those airport devices and saved in my keychain. They were some kind of default factory setting passwords.
    Anyway, none of my airport devices is asking me for a password now in order to see their configuration. And I have changed security over to WPA2.
    Message was edited by: pputnam

  • LR 1.3.1 waiting for non-existing xmp and thm files

    I am experiencing a problem where Lightroom 1.3.1 stalls while I am scrolling through larger folders/collections. This happens on some (specific) folders only, but can get to a point where LR becomes unusable.
    Trying to nail that down, I used a file monitor (filemon from sysinternals) and spotted that LR is looking for xmp and thm files that do not exist. The reason this is slow for me probably relates to the fact, that this search happens over my local network (because my original photos are on a different computer). Estimating numbers, LR waits approx 500 ms per photo (looking for .xmp, .XMP, .thm and .THM in that time), but only for some photos in that folder.
    I upgraded from 1.2 to 1.3.1 and am quite certain, that this was smooth with 1.2.
    My catalog definitely doesn't write to xmp automatically. I do in fact not have a single xmp file in any of my directories. In catalog settings I also have the 'Include develop settings in metadata in jpg...' deactivated (what does that btw?).
    Anyone experiencing similar issues? Any ideas what I am doing wrong here? Why is LR looking for those files in the first place?
    Stefan

    I am actually a bit surprised I am the only one hitting that problem.
    Does anyone else have a setup where the original photos are on a networked machine, and the working catalog is on the local machine where Lightroom is running? I assume this is why I am experiencing long delays whereas 'normal' users just don't notice that problem...

  • User names for non-existing guest accounts appearing in WCS reports

    Hi All,
    I currently have a client where we have deployed a guest network using webauth and the lobby ambassador account to provision guest users under WCS 5.2.
    When running client detail reports there are a number of odd behaviours that i don't understand.
    First and most importantly the username section of the report is populated with usernames that have never been provisioned and do not currently exist.
    I made a guess and thought maybe it was recording usernames of people who had attempted to log in via webauth using their normal user accounts as the recorded names were in this format but this did not generate an entry in the report.
    The second issue was that a lot of users had pulled down a few MB (8.5 was the highest at that point) of data while not authenticated. The standard webauth page is used with some minor changes and this is tiny so i can't account for where this data is coming from unless they are pulling down that page repeatedly.
    I am hoping someone will have experienced these 2 situations and can assist.
    Thanks
    Ben

    The username section can get populated from the users that do exist on the controller.
    The second issue doesnt make much sense, you may want to open a TAC SR to investigate this further

Maybe you are looking for

  • Requisition Request - Approval

    Hi there, I am trying to configure E-Recruiting in our system which are based on Enhancement Package 4. Also, we are using Netweaver Portal 7.0. Here is how I think the requisition scenario works: 1.) A Hiring manager creates a requisition based on a

  • How do i fix error 9 for 3g ipod?

    reboot and restart wont work and i tried all the other general options to fix it and they dont work.

  • E-mailing a 15mb movie

    I have just bought quicktime pro for windows as I need to mail the above. No-one at Apple can tell me how to do it!! Help

  • OID 10gR3 full version number and compatibility

    I am a bit confused about the OID version and compatibility. Can anyone help? Siteminder r12 is compatible with OID 10gR3 as per Siteminder compatibility matrix. When I try to find OID version number and in turn its compatibility with Operating syste

  • Custom Run-Time Menu Not Found in User.lib

    Our Instrument Run-Time Menus are getting lost. This is because we have some computers that are 32 bit and the code is located at C:\Program Files\National Instruments\LabVIEW 2011\user.lib\InstrumentDrivers Other computers are 64 bit and the code is