Query -suggest me

Hi Experts
        I am using the following query, my input as 'ZSO' only, but now the query is not working properly. what could be the reason. pls help me on this.
SELECT a~aufnr
       a~plnbez
       a~dispo
       b~kdauf
       b~kdpos
       c~budat
       c~werks
INTO CORRESPONDING FIELDS OF TABLE i_FINAL
FROM afko AS a
INNER JOIN afpo AS b ON aaufnr = baufnr
INNER JOIN afru AS c ON aaufnr = caufnr AND arueck = crueck AND armzhl = crmzhl
WHERE b~kdauf IN zso
AND b~kdpos IN zli
AND a~aufnr IN zauf
AND c~budat IN zdat
AND c~werks IN zpl
AND a~plnbez IN zmat.
Thanks in advance.
regards
Rajaram

yea, i have done 3 queries for 3 tables separately, but when execute for input for date, it takes long time.
bcoz,
SELECT AUFNR
       POSNR
       KDAUF
       DAUAT
       KDPOS FROM AFPO
INTO CORRESPONDING FIELDS OF TABLE i_afpo
FOR all entries in i_afko
where aufnr EQ i_afko-aufnr And
KDAUF IN ZSO AND
KDPOS IN ZLI.
SELECT AUFNR
       BUDAT
       ISDD
       WERKS
       SMENG
       ARBID
       RUECK
       RMZHL
       VORNR
       LTXA1
       GRUND
       STOKZ
       STZHL
       AENAM
       AUERU
       EXNAM
       LMNGA FROM AFRU
  INTO CORRESPONDING FIELDS OF TABLE i_AFRU
  FOR ALL ENTRIES IN i_afpo
  WHERE aufnr EQ i_afpo-aufnr AND
  BUDAT IN ZDAT AND
  WERKS IN ZPL.
input as 01.01.2007  to  01.03.2007
if the i_afpo has 5000 records, it takes too much time.
how can we solve this.

Similar Messages

  • Managing Query Suggestions through CSOM (C#) or PowerShell for Sharepoint Online.

    Hello everybody.
    I am currently working with Sharepoint Online search and am trying to find information about managing Query suggestions (CRUD operations).
    Would anybody have any information as to how I could do this in CSOM or PowerShell ? I truely am having a hard time on this.

    Hi,
    Please check below. This should help you. You can REST APIs
    Retrieving query suggestions using the Search REST service
    https://msdn.microsoft.com/en-us/library/office/dn194079.aspx
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • How to enable query suggestions

    How can the query suggestions be enabled in the Firefox address bar?

    Go to the Privacy tab (i.e. \Firefox\Options\Options) and for the Location Bar, choose "History and Bookmarks" (using the drop-down arrow).
    Next, go to the Advanced tab and under the General sub-tab, check the box that reads "Search for text when I start typing". Save and restart your browser.
    Hope that works.

  • Google's preference "Query Suggestions"

    I've got two machines, one running 10.4.11 and the current version of Safari
    one running 10.5.5 and the current version of Safari
    with the 10.4 machine and Safari: i can go to Google home page, then "preferences" when logged in, and i have a category "Query Suggestions"...
    on the 10.5 machine and safari, that category is completely missing? it is logged in to exactly the same google account. and Safari is exactly the same version..???
    any ideas?

    JonK.. wrote:
    that means there is something wrong with my system if you can see it??? or something wrong with a setting...
    That's why caching came to mind as the most likely culprit.
    The only other thing I can think to suggest is deleting any Google cookies and seeing if that makes a difference. I don't think that's like to be the answer, but it can't hurt to try.

  • Improve Query Suggestions Load time

    How can I improve load time for Pre Query Suggestions on search home page when user start typing ?? 
    I notice it was slow in loading when I hit first time in the morning so I try to warm up by adding
    ""http://SiteName/_api/search/suggest?querytext='sharepoint' ""
    in to warm up script but even during the day time after hitting few times it is slower some times . Any reason ? 
    Do you think moving Query Component to WFE will do any help here?
    Pleas let me know - Thanks .  

    Hi,
    Query Suggestions should work at a high level overview is:
    • You issue a query within a Search Center site and get results..
    • When you hover over or click a result.. this gets stored as a “RecordPageClick” method and will be stored in the Web Applications W3WP process…
    • Every five minutes ( I believe ) this W3WP will flush these Recorded Page Clicks and pass them over to the Search Proxy…
    • This will then store them in a table in the SSA ( Search Service Application ) Admin DB
    • By default, once a day, there is a timer job, Prepare Query Suggestions, that will run
    • It does a check to see if the same term has been queried for and clicked at least 6 times and then will move them to another table in the same DB..
    • If there are successful queries\clicks > 6 times for a term, and they move to the appropriate table, then when you start to type a word, like “share”
    • This will fire a “method” over to the Search proxy servers called “GetQuerySuggestions” and will check that Admin DB to see if they have any matches..
    • If so, then it will show up in your Search Box as like “SharePoint” for a suggestion…
    Other components involved with the Query Suggestions:
    Timer Jobs
    Prepare query suggestions                   Daily
    Query Classification Dictionary Update for Search Application Search Service Application       Minutes
    Query Logging                    Minutes
    Database
     MSSQLogQuerySuggestion (SearchDB)  This gets cleaned up when we run the timer job
     MSSQLogQueryString (SearchDB)  Info on the Query String
     MSSQLogSearchCounts (SearchDB)  Info on the click counts
     MSSQLogQuerySuggestion Looks like this may be where the hits for suggestions are stored
    So the issue might related to timer job, database, connection between SharePoint server and SQL server. There is  a similar case caused by DistributedCache.
    If you move query component on to another sever, this may improve the process related to Search service, however, it may affect the performance due to networking.
    Please collect verbose ULS log per steps below:
    Enable Verbose logging via Central Admin> Monitoring> Reporting>Configure diagnostic logging(You can simply set all the categories with Verbose level and I can filter myself).
    Reproduce the issue(Try to remove SSRS).
    Record the time and get a capture of the error message(including the correlation ID if there is). Collect the log file which is by default located in the folder:  <C:\Program files\common files\Microsoft Shared\web server extensions\15\LOGS>.
    Stop verbose logging.
    Regards,
    Rebecca Tu
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected].

  • Query suggestions

    Hi,
    I have written the following query, its taking long time to get records,
    SELECT VBCAR.MONTH_END_DATE,
              VBCAR.SOURCE_SYSTEM,
              RF1.PILLAR3_EXPOSURE_CLASS_CODE,
              VBCAR.EXPOSURE_CODE,
              VBCAR.EXPOSURE_CLASS_CODE,
              CASE
                   WHEN VBCAR.SOURCE_SYSTEM = 'ML' THEN 'Margin_Lending'
                   WHEN VBCAR.SOURCE_SYSTEM = 'ICBS' THEN 'Amicus'||VBCAR.CCIS_PRODUCT_GROUP
                   WHEN VBCAR.SOURCE_SYSTEM IN ('ACBS','ASNEMP') THEN 'Other'
                   WHEN VBCAR.SOURCE_SYSTEM = 'CLSORG' THEN 'CBNF_Excalibur'
                   WHEN VBCAR.SOURCE_SYSTEM = 'TARGET' AND VBCAR.EXPOSURE_CODE = 'UNDRAW' AND
                        VBCAR.ACC_RK = -1 THEN 'CBNF_Target'
                   WHEN VBCAR.SOURCE_SYSTEM = 'PCL' AND VBCAR.EXPOSURE_CLASS_CODE = 'REVOLV' AND
                        VBCAR.EXPOSURE_CODE = 'UNDRAW' THEN 'PLC_Unsecured'
                   ELSE VBCAR.CCIS_PRODUCT_GROUP
              END AS LINE_OF_BUSINESS,
              VBCAR.CCIS_PRODUCT,
              VBCAR.PD_VALUE,
              VBCAR.LGD_RATE,
              RF2.PD_BAND,
              RF2.PD_BAND_DESCRIPTION,
              RF3.RESIDUAL_MATURITY_TERM,
              SUM(VBCAR.PRE_SEC_EAD_AMT) AS EAD_PRE_SEC_PRE_CRM,
              SUM(VBCAR.POST_SEC_EAD_AMT) AS EAD_POST_SEC_PRE_CRM,
              SUM(CASE
                   WHEN VBCAR.EXPOSURE_CLASS_CODE = 'REMORT' AND VBCAR.EXPOSURE_CODE = 'DRAWN'
                        AND (VBCAR.INSURER_TYPE_CD IN ('GVN','PRI') OR VBCAR.ACC_SECURITIZED_IND = 'E') THEN 0
                   WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans' THEN VBCAR.POST_GOV_EAD_AMT
                   ELSE VBCAR.POST_SEC_EAD_AMT
                   END) AS EAD_POST_SEC_POST_CRM,
              CASE
                   WHEN VBCAR.EXPOSURE_CLASS_CODE ='REMORT' AND
                        VBCAR.ACC_SECURITIZED_IND = 'E' THEN 'FULLY INSURED'
                   WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans'
                        AND VBCAR.POST_GOV_EAD_AMT = 0 THEN 'FULLY INSURED'
                   WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans'
                        AND VBCAR.POST_GOV_EAD_AMT > 0 THEN 'PARTIALLY INSURED'
                   ELSE 'NOT INSURED'
              END AS INSURED_IND,
              CASE
                   WHEN VBCAR.ACC_SECURITIZED_IND = 'E' THEN 'FULLY SECURITIZED'
                   WHEN VBCAR.SOURCE_SYSTEM ='TSYS'
                        AND VBCAR.PRE_SEC_EAD_AMT > VBCAR.POST_SEC_EAD_AMT
                        THEN 'PARTIALLY SECURITIZED'
                   ELSE 'NOT SECURITIZED'
              END AS SECURITIZED_IND,
              VBCAR.NOTIONAL_PRINCIPAL_AMT,
              SUM(CASE
                   WHEN VBCAR.EXPOSURE_CLASS_CODE = 'REMORT' AND VBCAR.INSURER_TYPE_CD IN ('GVN','PRI') THEN 0
                   WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans' THEN VBCAR.POST_GOV_RWA_AMT
                   ELSE VBCAR.POST_SEC_RWA_AMT
                   END) AS RWA,
              SUM(CASE
                   WHEN VBCAR.EXPOSURE_CLASS_CODE = 'REMORT' AND VBCAR.INSURER_TYPE_CD IN ('GVN','PRI') THEN 0
                   WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans' THEN VBCAR.POST_GOV_EL_AMT
                   ELSE VBCAR.POST_SEC_EL_AMT
              END) AS EL,
              VBCAR.POST_SEC_RWA_AMT * .08 AS CAPITAL,
              RF4.GEO_SECTION,
              COUNT(1),
              VBCAR.PD_MODEL_ID,
              SYSDATE,
              SYSDATE,
              'PILLAR3'
              FROM RCDWSTG.V_BCAR_DETAIL_ADJ VBCAR,               
                   REFERENCE.REF_P3_BCAR_EXPOSURE_CLASS_CD RF1,
                   REFERENCE.REF_PD_BAND RF2,
                   REFERENCE.REF_MATURITY_TERM RF3,
                   REFERENCE.REF_GEO_SECTION RF4,
                   (SELECT VBC.ACC_RK FROM RCDWSTG.V_BCAR_DETAIL_ADJ VBC, RCDWSTG.STG_FIN_ACC STFC,
                             (SELECT MAX(SRC.PARTY_SRC_RK), ACC_RK
                             FROM RCDWSTG.STG_FIN_ACC_PARTY_SRC SRC,
                             RCDWSTG.STG_PARTY_SRC PRTY
                             WHERE SRC.PARTY_SRC_RK = PRTY.PARTY_SRC_RK
                             AND SRC.PARTY_ROLE_CD = 'BOR'
                             GROUP BY ACC_RK) INV1
                   WHERE VBC.ACC_RK = STFC.ACC_RK
                   AND STFC.ACC_RK = INV1.ACC_RK
                   ) INV1                                   
              WHERE VBCAR.EXPOSURE_CLASS_CODE = RF1.BCAR_EXPOSURE_CLASS_CODE
              AND VBCAR.PD_BAND = RF2.PD_BAND
              AND VBCAR.ACC_RK =     INV1.ACC_RK               
              GROUP BY VBCAR.MONTH_END_DATE,
                   VBCAR.SOURCE_SYSTEM,
                   RF1.PILLAR3_EXPOSURE_CLASS_CODE,
                   VBCAR.EXPOSURE_CODE,
                   VBCAR.EXPOSURE_CLASS_CODE,
                   CASE
                        WHEN VBCAR.SOURCE_SYSTEM = 'ML' THEN 'Margin_Lending'
                        WHEN VBCAR.SOURCE_SYSTEM = 'ICBS' THEN 'Amicus'||VBCAR.CCIS_PRODUCT_GROUP
                        WHEN VBCAR.SOURCE_SYSTEM IN ('ACBS','ASNEMP') THEN 'Other'
                        WHEN VBCAR.SOURCE_SYSTEM = 'CLSORG' THEN 'CBNF_Excalibur'
                        WHEN VBCAR.SOURCE_SYSTEM = 'TARGET' AND VBCAR.EXPOSURE_CODE = 'UNDRAW' AND
                             VBCAR.ACC_RK = -1 THEN 'CBNF_Target'
                        WHEN VBCAR.SOURCE_SYSTEM = 'PCL' AND VBCAR.EXPOSURE_CLASS_CODE = 'REVOLV' AND
                             VBCAR.EXPOSURE_CODE = 'UNDRAW' THEN 'PLC_Unsecured'
                        ELSE VBCAR.CCIS_PRODUCT_GROUP
                   END,
                   VBCAR.CCIS_PRODUCT,
                   VBCAR.PD_VALUE,
                   VBCAR.LGD_RATE,
                   RF2.PD_BAND,
                   RF2.PD_BAND_DESCRIPTION,
                   RF3.RESIDUAL_MATURITY_TERM,
                   CASE
                        WHEN VBCAR.EXPOSURE_CLASS_CODE ='REMORT' AND
                             VBCAR.ACC_SECURITIZED_IND = 'E' THEN 'FULLY INSURED'
                        WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans'
                             AND VBCAR.POST_GOV_EAD_AMT = 0 THEN 'FULLY INSURED'
                        WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans'
                             AND VBCAR.POST_GOV_EAD_AMT > 0 THEN 'PARTIALLY INSURED'
                        ELSE 'NOT INSURED'
                   END,
                   CASE
                        WHEN VBCAR.ACC_SECURITIZED_IND = 'E' THEN 'FULLY SECURITIZED'
                        WHEN VBCAR.SOURCE_SYSTEM ='TSYS'
                             AND VBCAR.PRE_SEC_EAD_AMT > VBCAR.POST_SEC_EAD_AMT
                        THEN 'PARTIALLY SECURITIZED'
                        ELSE 'NOT SECURITIZED'
                   END,
                   VBCAR.NOTIONAL_PRINCIPAL_AMT,
                   (VBCAR.POST_SEC_RWA_AMT * .08),
                   RF4.GEO_SECTION,               
                   VBCAR.PD_MODEL_ID
    I have included a inline view in the from clause and checked the values in the where clause. Can anybody give some tips or suggestions to improve this query performance or to rewrite the query.
    Thanks
    Radha K

    Does something (the execution plan) change if you make it a two step process: prepare data as the first and summing as the next step
    select month_end_date,source_system,pillar3_exposure_class_code,exposure_code,
           exposure_class_code, line_of_business,ccis_product,pd_value,lgd_rate,pd_band,
           pd_band_description, residual_maturity_term,
           sum(pre_sec_ead_amt) as ead_pre_sec_pre_crm,
           sum(vbcar.post_sec_ead_amt) as ead_post_sec_pre_crm,
           sum(post_sec_post_crm) as ead_post_sec_post_crm,
           insured_ind,securitized_ind,notional_principal_amt,
           sum(rwa) as rwa,
           sum(el) as el,
           capital,count_1,pd_model_id,
           sysdate,
           sysdate,
           'PILLAR3'
      from (SELECT VBCAR.MONTH_END_DATE,
                   VBCAR.SOURCE_SYSTEM,
                   RF1.PILLAR3_EXPOSURE_CLASS_CODE,
                   VBCAR.EXPOSURE_CODE,
                   VBCAR.EXPOSURE_CLASS_CODE,
                   CASE WHEN VBCAR.SOURCE_SYSTEM = 'ML'
                        THEN 'Margin_Lending'
                        WHEN VBCAR.SOURCE_SYSTEM = 'ICBS'
                        THEN 'Amicus'||VBCAR.CCIS_PRODUCT_GROUP
                        WHEN VBCAR.SOURCE_SYSTEM IN ('ACBS','ASNEMP')
                        THEN 'Other'
                        WHEN VBCAR.SOURCE_SYSTEM = 'CLSORG'
                        THEN 'CBNF_Excalibur'
                        WHEN VBCAR.SOURCE_SYSTEM = 'TARGET'
                         AND VBCAR.EXPOSURE_CODE = 'UNDRAW'
                         AND VBCAR.ACC_RK = -1
                        THEN 'CBNF_Target'
                        WHEN VBCAR.SOURCE_SYSTEM = 'PCL'
                         AND VBCAR.EXPOSURE_CLASS_CODE = 'REVOLV'
                         AND VBCAR.EXPOSURE_CODE = 'UNDRAW'
                        THEN 'PLC_Unsecured'
                        ELSE VBCAR.CCIS_PRODUCT_GROUP
                   END AS LINE_OF_BUSINESS,
                   VBCAR.CCIS_PRODUCT,
                   VBCAR.PD_VALUE,
                   VBCAR.LGD_RATE,
                   RF2.PD_BAND,
                   RF2.PD_BAND_DESCRIPTION,
                   RF3.RESIDUAL_MATURITY_TERM,
                   VBCAR.PRE_SEC_EAD_AMT,
                   VBCAR.POST_SEC_EAD_AMT,
                   CASE WHEN VBCAR.EXPOSURE_CLASS_CODE = 'REMORT'
                         AND VBCAR.EXPOSURE_CODE = 'DRAWN'
                         AND (VBCAR.INSURER_TYPE_CD IN ('GVN','PRI')
                          OR  VBCAR.ACC_SECURITIZED_IND = 'E'
                        THEN 0
                        WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans'
                        THEN VBCAR.POST_GOV_EAD_AMT
                        ELSE VBCAR.POST_SEC_EAD_AMT
                   END_POST_SEC_POST_CRM,
                   CASE WHEN VBCAR.EXPOSURE_CLASS_CODE ='REMORT'
                         AND VBCAR.ACC_SECURITIZED_IND = 'E'
                        THEN 'FULLY INSURED'
                        WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans'
                         AND VBCAR.POST_GOV_EAD_AMT = 0
                        THEN 'FULLY INSURED'
                        WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans'
                         AND VBCAR.POST_GOV_EAD_AMT > 0
                        THEN 'PARTIALLY INSURED'
                        ELSE 'NOT INSURED'
                   END AS INSURED_IND,
                   CASE WHEN VBCAR.ACC_SECURITIZED_IND = 'E'
                        THEN 'FULLY SECURITIZED'
                        WHEN VBCAR.SOURCE_SYSTEM ='TSYS'
                         AND VBCAR.PRE_SEC_EAD_AMT > VBCAR.POST_SEC_EAD_AMT
                        THEN 'PARTIALLY SECURITIZED'
                        ELSE 'NOT SECURITIZED'
                   END AS SECURITIZED_IND,
                   VBCAR.NOTIONAL_PRINCIPAL_AMT,
                   CASE WHEN VBCAR.EXPOSURE_CLASS_CODE = 'REMORT'
                         AND VBCAR.INSURER_TYPE_CD IN ('GVN','PRI')
                        THEN 0
                        WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans'
                        THEN VBCAR.POST_GOV_RWA_AMT
                        ELSE VBCAR.POST_SEC_RWA_AMT
                   END AS RWA,
                   CASE WHEN VBCAR.EXPOSURE_CLASS_CODE = 'REMORT'
                         AND VBCAR.INSURER_TYPE_CD IN ('GVN','PRI')
                        THEN 0
                        WHEN VBCAR.CCIS_PRODUCT_GROUP = 'Student_Loans'
                        THEN VBCAR.POST_GOV_EL_AMT
                        ELSE VBCAR.POST_SEC_EL_AMT
                   END AS EL,
                   VBCAR.POST_SEC_RWA_AMT * .08 AS CAPITAL,
                   RF4.GEO_SECTION,
                   COUNT(1) AS COUNT_1,
                   VBCAR.PD_MODEL_ID
              FROM RCDWSTG.V_BCAR_DETAIL_ADJ VBCAR,
                   REFERENCE.REF_P3_BCAR_EXPOSURE_CLASS_CD RF1,
                   REFERENCE.REF_PD_BAND RF2,
                   REFERENCE.REF_MATURITY_TERM RF3,
                   REFERENCE.REF_GEO_SECTION RF4,
                   (SELECT VBC.ACC_RK
                      FROM RCDWSTG.V_BCAR_DETAIL_ADJ VBC,
                           RCDWSTG.STG_FIN_ACC STFC,
                           (SELECT MAX(SRC.PARTY_SRC_RK), ACC_RK
                              FROM RCDWSTG.STG_FIN_ACC_PARTY_SRC SRC,
                                   RCDWSTG.STG_PARTY_SRC PRTY
                             WHERE SRC.PARTY_SRC_RK = PRTY.PARTY_SRC_RK
                               AND SRC.PARTY_ROLE_CD = 'BOR'
                             GROUP BY ACC_RK
                           ) INV1
                     WHERE VBC.ACC_RK = STFC.ACC_RK
                       AND STFC.ACC_RK = INV1.ACC_RK
                   ) INV1
             WHERE VBCAR.EXPOSURE_CLASS_CODE = RF1.BCAR_EXPOSURE_CLASS_CODE
               AND VBCAR.PD_BAND = RF2.PD_BAND
               AND VBCAR.ACC_RK = INV1.ACC_RK
    group by month_end_date,
              source_system,
              pillar3_exposure_class_code,
              exposure_code,
              exposure_class_code,
              line_of_business,
              ccis_product,
              pd_value,
              lgd_rate,
              pd_band,
              pd_band_description,
              residual_maturity_term,
              insured_ind,
              securitized_ind,
              notional_principal_amt,
              capital,
              geo_section,
              pd_model_idRegards
    Etbin

  • Query Suggestions with -Level SPSite or SPWeb, how to retreive results?

    I can see the results on powershell window if I pass -Level with Owner object in below command, but how can i see same results with _api suggest query?
    Get-SPEnterpriseSearchQuerySuggestionCandidates -SearchApplication $searchapp -Owner $owner

    Hi Ramana,
    Based on the list of parameters for the search rest api in the following article, there is no similar/same function as cmdlet used available for rest service endpoint _api/search/suggest, so, we are unable to use it
    via _api suggest query currently.
    https://msdn.microsoft.com/EN-US/library/office/dn194079.aspx
    http://blogs.msdn.com/b/nadeemis/archive/2012/08/24/sharepoint-2013-search-rest-api.aspx
    Thanks
    Daniel Yang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Query suggestion

    Hi All,
    I need to apply condition where column should not be null and also must not be an empty string.
    I wrote like:
    WHERE (TRIM(ITEM_BAR_CODE)!='' AND ITEM_BAR_CODE IS NOT NULL) OR (TRIM(ITEM_COLOR)!='' AND ITEM_COLOR IS NOT NULL) But I am not getting the accurate results.
    I know its a very silly question, but somehow I am not getting the solution. :-(
    Please suggest.
    Thanks to all
    Bhupinder

    Here Oracle converts an empty string to NULL after
    trim. Don't you read what people write you?
    Rob wrote:
    Empty strings are considered nulls too.
    Oracle processes an empty string in a SQL statement as a null value.

  • UPDATE query suggestions

    We have a need for an update query, but we're starting with a SELECT statment to make sure that the update will only change the required number of records. We started with:
    select t1.act_num, t1.text || ' ' || (select text
                                            from BAC t2
                                           where comtype = 'Request'
                                             and type = 'A'
                                             and t1.act_num = t2.act_num) as appended_text
    from BAC t1
    where comtype = 'Result'
      and type = 'A'This query takes quite awhile to run, bringing back about 500 records every 30 seconds. The query plan isn't that complex. Full scan on "t1", which makes sense because 1/3 of the type 'A' records have a comtype of 'Result'. Then, there's an index-based retrieval for the "t2" records.
    I can write the query another way, which runs in under 20 seconds, but it's format won't fit into an update query:
    select t1.act_num, t1.text || ' ' || t2.text as appended_text
    from BAC t1, BAC t2
    where t1.act_num = t2.act_num
      and t1.comtype = 'Result'
      and t1.type = 'A'
      and t2.comtype = 'Request'
      and t2.type = 'A'I tried already and got a "No key-preserved table" error:
    update (select t1.text as t1_text, t2.text as t2_text
              from BAC t1, BAC t2
             where t1.act_num = t2.act_num
               and t1.comtype = 'Result'
               and t1.type = 'A'
               and t2.comtype = 'Request'
               and t2.type = 'A')
       set t1_text = t1_text ||' '||t2_text;So does this mean it's just an update that is destined to be slow? The reason why I'm a bit confused as to the lethargy of the SELECT is that there are only about 350,000 records in this table, about 108,000 of which are actually being updated. It's just not that much data.
    Thanks,
    --=Chuck

    Here's a new one for me ...
    That act_num column was the 5th column in a 6-column primary key index. While the logic would have correctly updated the records like we wanted, Oracle would rather have more information. The following ran in a very acceptable time:
    select t1.act_num, t1.text || ' ' || (select text
                                            from BAC t2
                                           where comtype = 'Request'
                                             and type = 'A'
                                             and t1.act_num = t2.act_num
                                             and t1.pk1 = t2.pk1
                                             and t1.pk2 = t2.pk2
                                             and t1.pk3 = t2.pk3
                                             and t1.pk4 = t2.pk4
                                          ) as appended_text
    from BAC t1
    where comtype = 'Result'
      and type = 'A'This is in Oracle 11gR1.
    --=Chuck

  • Query suggestions needed

    Please help with this complex query, I have been working on a solution for hours now. Here is a simplified version:
    I have 3 fields in tableA:field1, field2, field3
    I want to return all those records that have both field2 and field3 the same but field1 different.
    For example:
    Field1 Field2 Field3
    ======================
    Cars Blue 6 liter
    Cars Blue 6 liter
    Van Blue 6 liter
    Cars Green 5 liter
    Cars Green 5 liter
    I need the first 3 records returned because field2 and field3 are the same but field1 is different.
    Anyone have any ideas?

    I think the second SELECT is unnessary. In other words, the following should be equivalent:
    SELECT
        TABLEA.*
    FROM
        TABLEA
    WHERE
        (FIELD2, FIELD3)
        IN
            SELECT
                FIELD2,
                FIELD3
            FROM
                    SELECT DISTINCT
                        FIELD1,
                        FIELD2,
                        FIELD3
                    FROM
                        TABLEA
            GROUP BY
                FIELD2,
                FIELD3
            HAVING
                COUNT(*) > 1
        )Assuming FIELD1 is NOT NULL, it is also possible to eliminate the SELECT DISTINCT by using COUNT(DISTINCT...), as in something like:
    SELECT
        TABLEA.*
    FROM
        TABLEA
    WHERE
        (FIELD2, FIELD3)
        IN
            SELECT
                FIELD2,
                FIELD3
            FROM
                TABLEA
            GROUP BY
                FIELD2,
                FIELD3
            HAVING
                COUNT(DISTINCT FIELD1) > 1
        )No doubt there are yet other solutions using analytics.

  • Query suggestions / help

    Hi @ll,
    I am creating a query for searching order / invoices. Only customers should be displayed, who ordered least 90 days before and there is no order for a earlier time.
    SELECT MAX(T0.DocDate), T0.CardCode FROM OINV T0
    WHERE DATEDIFF(day, MAX(T0.DocDate), getdate()) <= 90
    GROUP BY T0.CardCode, T0.DocDate
    ORDER BY T0.CardCode, T0.DocDate DESC
    Datediff works well, but not with the MAX statement. If i use only Datediff(day, T0.DocDate, getdate()) = 90, it displays also customers, who ordered in a earlier time.
    Regards Steffen

    Under stood try this
    select A.CardCode from (
    select T0.Docdate,T0.CardCode From OINV T0
    where
    T0.CardCode not in (Select S0.CardCode from OINV S0 where S0.Docdate between getdate()-90 and getdate())
    )A
    Group By
    A.CardCode
    Regards,
    Thanga Raj.K
    Edited by: Thanga Raj K on Jun 9, 2009 12:30 PM

  • Search suggestion not working for anonymous user in sharepoint 2013

    Hi ,
    Please help on this search suggestion not working for anonymous user in sharepoint 2013
    shaik

    You can create a search center site, and set the search center site to
    allow anonymous access.
    Also see this link - http://blog.mastykarz.nl/search-query-suggestions-anonymous-users-sharepoint-2013-mavention-query-suggestions/ 
     (As this is regarding a 3rd party tool, I suggest that you direct it to the  provider support.)
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Creating new Auto-Suggest Component

    Hi,
    I am new to ADF and looking for Auto-Suggest options. Found Franks code and it was really heplful.
    We tried to create a new component based on this but not able to use multiple components of the type on the same page/form.The problem we are thinking of is because of the popup having the same id for all the components we embed in.If we attach 3 components of this type to a form then one of the random ones work as per logic and other 2 not doing any pop ups at all.
    Could you please help us to resolve this please?
    Thanks
    Subha
    CODE
    suggestComponentModel.java
    package com.dstintl.ic.ui.component.suggestbox;
    import java.util.List;
    public interface SuggestComponentModel{
    * Method called to filter data shown in the suggest list. Initial
    * request is made with inMemory = false. If in memory sorting is
    * enabled then all subsequent calls are made passing trues as the
    * value for the inMemory parameter. Implementations may decid to
    * ignore the inMemory argument and always query the data source.
    public List<String> filteredValues(String filterCriteria,
    boolean inMemory);
    SuggestBoxTag.java+
    package com.dstintl.ic.ui.component.suggestbox;
    import javax.el.ValueExpression;
    import oracle.adf.view.rich.component.rich.fragment.RichDeclarativeComponent;
    import oracle.adfinternal.view.faces.taglib.region.RichDeclarativeComponentTag;
    import org.apache.myfaces.trinidad.bean.FacesBean;
    * ICDateComponent tag class.
    public class SuggestBoxTag extends RichDeclarativeComponentTag {
         /*input text properties*/
    private ValueExpression styleClass;
    private ValueExpression label;
    private ValueExpression required;
    private ValueExpression displayWidth;
    private ValueExpression maximumLength;
    private ValueExpression tooltip;
    private ValueExpression disabled;
    /*popup properties*/
    private ValueExpression itemList;
    * {@inheritDoc}
    @Override
    protected String getViewId() {
    return "/component/SuggestBox.jspx";
    * {@inheritDoc}
    @Override
    protected RichDeclarativeComponent createComponent() {
    return new SuggestBox();
    * {@inheritDoc}
    @Override
    public void release() {
    super.release();
    label = null;
    * {@inheritDoc}
    @Override
    protected void setProperties(final FacesBean bean) {
    super.setProperties(bean);
    /*Input text box properties*/
    if (label != null) {
    bean.setValueExpression(SuggestBox.LABEL_KEY, label);
    if (styleClass != null) {
    bean.setValueExpression(SuggestBox.STYLE_CLASS_KEY, styleClass);
    if (required != null) {
    bean.setValueExpression(SuggestBox.REQUIRED_KEY, required);
    if (displayWidth != null) {
    bean.setValueExpression(SuggestBox.DISPLAY_WIDTH_KEY, displayWidth);
    if (maximumLength != null) {
    bean.setValueExpression(SuggestBox.MAXIMUM_LENGTH_KEY, maximumLength);
    if (tooltip != null) {
    bean.setValueExpression(SuggestBox.TOOLTIP_KEY, tooltip);
    if (disabled != null) {
    bean.setValueExpression(SuggestBox.DISABLED_KEY, disabled);
    if (itemList != null) {
    bean.setValueExpression(SuggestBox.POPUP_SELECTITEMLIST_KEY, itemList);
    * @return label
    public ValueExpression getLabel() {
    return label;
    * @param label
    * label
    public void setLabel(ValueExpression label) {
    this.label = label;
    * @return style class.
    public ValueExpression getStyleClass() {
    return styleClass;
    * @param styleClass
    * style class.
    public void setStyleClass(ValueExpression styleClass) {
    this.styleClass = styleClass;
    * @param required
    * required.
         public void setrequired(ValueExpression required) {
              this.required = required;
    * @return required .
         public ValueExpression getrequired() {
              return required;
    * @param displayWidth
    * displayWidth.
         public void setDisplayWidth(ValueExpression displayWidth) {
              this.displayWidth = displayWidth;
    * @return displayWidth .
         public ValueExpression getDisplayWidth() {
              return displayWidth;
    * @param maximumLength
    * maximumLength.
         public void setmaximumLength(ValueExpression maximumLength) {
              this.maximumLength = maximumLength;
    * @return maximumLength .
         public ValueExpression getmaximumLength() {
              return maximumLength;
    * @param tooltip
    * tooltip.
         public void setTooltip(ValueExpression tooltip) {
              this.tooltip = tooltip;
    * @return tooltip .
         public ValueExpression getTooltip() {
              return tooltip;
    * @param disabled
    * disabled.
         public void setDisabled(ValueExpression disabled) {
              this.disabled = disabled;
    * @return disabled .
         public ValueExpression getDisabled() {
              return disabled;
    * @param itemList
    * itemList.
         public void setItemList(ValueExpression itemList) {
              this.itemList = itemList;
    * @return itemList .
         public ValueExpression getItemList() {
              return itemList;
    SuggestBox.java+
    package com.dstintl.ic.ui.component.suggestbox;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.component.UIComponent;
    import javax.faces.model.SelectItem;
    import oracle.adf.view.rich.component.rich.fragment.RichDeclarativeComponent;
    import oracle.adf.view.rich.component.rich.input.RichSelectOneListbox;
    import oracle.adf.view.rich.context.AdfFacesContext;
    import oracle.adf.view.rich.render.ClientEvent;
    import org.apache.myfaces.trinidad.bean.PropertyKey;
    * suggestBox.
    public class SuggestBox extends RichDeclarativeComponent {
    /** label. **/
    public static final PropertyKey LABEL_KEY = PropertyKey.createPropertyKey("label");
    /** styleClass **/
    public static final PropertyKey STYLE_CLASS_KEY = PropertyKey.createPropertyKey("styleClass");
    /** required **/
    public static final PropertyKey REQUIRED_KEY = PropertyKey.createPropertyKey("required");
    /** displayWidth **/
    public static final PropertyKey DISPLAY_WIDTH_KEY = PropertyKey.createPropertyKey("displayWidth");
    /** precision **/
    public static final PropertyKey MAXIMUM_LENGTH_KEY = PropertyKey.createPropertyKey("maximumLength");
    /** toolTip **/
    public static final PropertyKey TOOLTIP_KEY = PropertyKey.createPropertyKey("tooltip");
    /**disabled **/
    public static final PropertyKey DISABLED_KEY = PropertyKey.createPropertyKey("disabled");
    /** itemList **/
    public static final PropertyKey POPUP_SELECTITEMLIST_KEY = PropertyKey.createPropertyKey("itemList");
    * Constructor.
    public SuggestBox() {
    * Gets the value set to the <code>label</code> attribute.
    * @return String label.
    public String getLabel() {
    String t = (String) getAttributes().get("label");
    return t;
    * Gets the value set to the <code>styleClass</code> attribute.
    * @return String styleClass.
    public String getStyleClass() {
    String t = (String) getAttributes().get("styleClass");
    return t;
    * Gets the value set to the <code>required</code> attribute.
    * @return b.
    public boolean getrequired() {
    Boolean b = (Boolean) getAttributes().get("required");
    return b;
    * Gets the value set to the <code>displayWidth</code> attribute.
    * @return String displayWidth.
    public String getDisplayWidth() {
    String t = (String) getAttributes().get("displayWidth");
    return t;
    * Gets the value set to the <code>precision</code> attribute.
    * @return String precision.
    public String getMaximumLength() {
    String t = (String) getAttributes().get("maximumLength");
    return t;
    * Gets the value set to the <code>toolTip</code> attribute.
    * @return String styleClass.
    public String getToolTip() {
    String t = (String) getAttributes().get("tooltip");
    return t;
    * Gets the value set to the <code>disabled</code> attribute.
    * @return b.
    public boolean getDisabled() {
    Boolean b = (Boolean) getAttributes().get("disabled");
    return b;
    * Main popUp functionality.
         /**Get popUpId label */
    private String popUpLabel;
    public void setPopUpLabel(String popUpLabel) {
              this.popUpLabel = popUpLabel;
         public String getPopUpLabel() {
              this.popUpLabel =(String) getAttributes().get("label");
              return popUpLabel;
    /** fullitemList from the binding **/
    private List<SelectItem> fullitemList;
    /** suggestedList - to populate list of suggestions squeezed from the fullitemList **/
    private List<SelectItem> suggestedList = new ArrayList<SelectItem>();
    /** suggestListBox - attached to the Main popUp RichSelectOneListbox**/
    private RichSelectOneListbox suggestListBox;
    * sets suggestListBox
         public void setSuggestListBox(RichSelectOneListbox suggestListBox) {
              this.suggestListBox = suggestListBox;
    * gets suggestListBox
    * @return suggestListBox
         public RichSelectOneListbox getSuggestListBox() {
              return suggestListBox;
    * Sets suggested list on the selectOneListbox component
    * @param suggestedList
    * suggestedList.
         public void setSuggestedList(List<SelectItem> suggestedList) {
              this.suggestedList = suggestedList;
    * Retrieves the list from the bindings and
    * initialise suggestedList with the full list(only done during initialisation)
    * @return suggestedList.
         public List<SelectItem> getSuggestedList() {
              if(fullitemList == null){
                   fullitemList = new ArrayList<SelectItem>();
         List<SelectItem> result = (List<SelectItem>) getAttributes().get("itemList");
         this.fullitemList.addAll(result);
         this.suggestedList.addAll(result);
              return suggestedList;
    * doFilterList - On Every user keystroke in the suggest input field, the browser client calls
    * the doFilterList method through the af:serverListerner component
    * af:selectoneListbox (popup) is refreshed at the end of each call to the doFileterList so that
    * new list value is populated.
    * @param clientEvent
    public void doFilterList(ClientEvent clientEvent) {
         if(suggestListBox == null) {
              UIComponent uic = clientEvent.getComponent();
              suggestListBox = (RichSelectOneListbox) uic.getChildren().get(0);
    // set the content for the suggest list
    String srchString = (String)clientEvent.getParameters().get("filterString");
    this.suggestedList.clear();
    for(SelectItem item : fullitemList) {
         if( item.getLabel().contains(srchString)){
         this.suggestedList.add(item);
    AdfFacesContext.getCurrentInstance().addPartialTarget(suggestListBox);
    SuggestBox.jspx+
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
         <jsp:directive.page contentType="text/html;charset=windows-1252" />
         <af:componentDef var="attrs" componentVar="component">
    <af:document>
    <f:facet name="metaContainer">
    <af:group>
    <![CDATA[
    <script>
    function handleKeyUpOnSuggestField(evt){
    // start the popup aligned to the component that launched it
    suggestPopup = evt.getSource().findComponent("suggestPopup");
    inputField = evt.getSource();
    //don't open when user "tabs" into field
    if (suggestPopup.isShowing() == false &&
    evt.getKeyCode()!= AdfKeyStroke.TAB_KEY){
    hints = {align:AdfRichPopup.ALIGN_AFTER_START, alignId:evt.getSource().getClientId()+"::content"};
    suggestPopup.show(hints);
    //disable popup hide to avoid popup to flicker on
    //key press
    suggestPopup.hide = function(){}
    //suppress server access for the following keys
    //for better performance
    if (evt.getKeyCode() == AdfKeyStroke.ARROWLEFT_KEY ||
    evt.getKeyCode() == AdfKeyStroke.ARROWRIGHT_KEY ||
    evt.getKeyCode() == AdfKeyStroke.ARROWDOWN_KEY ||
    evt.getKeyCode() == AdfKeyStroke.SHIFT_MASK ||
    evt.getKeyCode() == AdfKeyStroke.END_KEY ||
    evt.getKeyCode() == AdfKeyStroke.ALT_KEY ||
    evt.getKeyCode() == AdfKeyStroke.HOME_KEY) {
    return false;
    if (evt.getKeyCode() == AdfKeyStroke.ESC_KEY){
    hidePopup(evt);
    return false;
    // get the user typed values
    valueStr = inputField.getSubmittedValue();
    // query suggest list on the server
    AdfCustomEvent.queue(suggestPopup,"suggestServerListener",
    // Send single parameter
    {filterString:valueStr},true);
    // put focus back to the input text field
    setTimeout("inputField.focus();",400);
    //TAB and ARROW DOWN keys navigate to the suggest popup
    //we need to handle this in the key down event as otherwise
    //the TAB doesn't work
    function handleKeyDownOnSuggestField(evt){               
    if (evt.getKeyCode() == AdfKeyStroke.ARROWDOWN_KEY) {                   
    selectList = evt.getSource().findComponent("suggestListBox");
    selectList.focus();
    return false;
    else{
    return false;
    //method called when pressing a key or a mouse button
    //on the list
    function handleListSelection(evt){
    if(evt.getKeyCode() == AdfKeyStroke.ENTER_KEY ||
    evt.getType() == AdfUIInputEvent.CLICK_EVENT_TYPE){                                          
    var list = evt.getSource();
    evt.cancel();
    var listValue = list.getProperty("value");
    hidePopup(evt);
    inputField = evt.getSource().findComponent("suggestField");
    inputField.setValue(listValue);
    //cancel dialog
    else if (evt.getKeyCode() == AdfKeyStroke.ESC_KEY){
    hidePopup(evt);
    //function that re-implements the node functionality for the
    //popup to then call it
    function hidePopup(evt){
    var suggestPopup = evt.getSource().findComponent("suggestPopup");
    //re-implement close functionality
    suggestPopup.hide = AdfRichPopup.prototype.hide;
    suggestPopup.hide();
    </script>
    ]]>
    </af:group>
    </f:facet>
    <af:messages/>
    </af:document>
         <!-- START Suggest Field -->
         <af:inputText id="suggestField"
         clientComponent="true"
         disabled="#{attrs.disabled}"
         label="#{attrs.label}"
         required="#{attrs.required}"
         columns="#{attrs.displayWidth}"
         maximumLength="#{attrs.maximumLength}"
         styleClass="#{attrs.styleClass}"
         shortDesc="#{attrs.tooltip}">
         <af:clientListener method="handleKeyUpOnSuggestField"
                             type="keyUp"/>
         <af:clientListener method="handleKeyDownOnSuggestField"
         type="keyDown"/>
         </af:inputText>
         <!-- END Suggest Field -->
         <!-- START Suggest popUp -->
    <af:popup id="suggestPopup" contentDelivery="immediate" animate="false" clientComponent="true" >
         <af:selectOneListbox id="suggestListBox" contentStyle="width: 250px;"
         size="5" valuePassThru="true">
         <f:selectItems value="#{component.suggestedList}"/>
         <af:clientListener method="handleListSelection" type="keyUp"/>
         <af:clientListener method="handleListSelection" type="click"/>
         </af:selectOneListbox>
         <af:serverListener type="suggestServerListener"
         method="#{component.doFilterList}"/>
    </af:popup>
         <!-- END Suggest popUp -->
    <af:xmlContent>
                   <component xmlns="http://xmlns.oracle.com/adf/faces/rich/component">
    <display-name>suggestBox</display-name>
    <attribute>
    <attribute-name>id</attribute-name>
    </attribute>
                        <attribute>
    <attribute-name>label</attribute-name>
    </attribute>
    <component-extension>
    <component-tag-namespace>com.dstintl.ic.ui.component</component-tag-namespace>
    <component-taglib-uri>/com/dstintl/ic/ui/component</component-taglib-uri>
    </component-extension>
    </component>
    </af:xmlContent>
    </af:componentDef>
    </jsp:root>
    component.tld+
    <?xml version="1.0" encoding="windows-1252"?>
    <taglib xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" version="2.1" xmlns="http://java.sun.com/xml/ns/javaee">
         <display-name>component</display-name>
         <tlib-version>1.0</tlib-version>
         <short-name>component</short-name>
         <uri>/com/dstintl/ic/ui/component</uri>
         <!--
              Component Name: SuggestBox Description: AutoSuggest or AutoComplete - shows a list of vales
              in a drop down list that is filtered by the user input in the input text field.
         -->
         <tag>
              <name>SuggestBox</name>
              <tag-class>com.dstintl.ic.ui.component.suggestbox.SuggestBoxTag</tag-class>
              <body-content>JSP</body-content>
              <attribute>
                   <name>label</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>styleClass</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>disabled</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>required</name>
                   <required>false</required>
                   <deferred-value>
                        <type>boolean</type>
                   </deferred-value>
              </attribute>
              <attribute>
                   <name>displayWidth</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>maximumLength</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>tooltip</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
              <attribute>
                   <name>itemList</name>
                   <required>false</required>
                   <deferred-value/>
              </attribute>
         </tag>
    </taglib>

    Hi Subha,
    you can distinct the different components using clientAttribute tag with clientListener
    <af:inputText id="suggestField" .....>
    <af:clientListener method="handleKeyUpOnSuggestField" type="keyUp"/>
    <af:clientListener ......"/>
    <af:*clientAttribute* name="eventName" value="myCustomEvent"/>
    <af:*clientAttribute* name="popupId" value="......"/>
    </af:inputText>
    in javascript you get the eventName or PopuId from the attribute
    component = event.getSource();
    var eventName = component.*getProperty* ("eventName");
    // Call the server
    AdfCustomEvent.queue(popup, *eventName*, ......);
    var popupId = component.*getProperty* ("popuId");
    var popup = AdfPage.PAGE.findComponent(popupId);
    Hope this help,
    Maroun

  • Search suggestion not showing normal suggestion

    HI
    We have configured search center and enabled query suggestion.When we type it only show people suggestion and no other suggestion is shown.
    I have even tried searching some general item and click on link multiple times (more than 6) but still it didn't work.I have run both the timer job.
    I have tested suggestion using search query tool and it also show people suggestion only.
    Then I started deep diving into this and found that link store database store the clicks query logging timer job add the clicks in the table of link store database.After that when I run prepare query suggestion Nothing happens.Even I don't get any error.
    when I try to type some letter of that word no suggestion crops up
    Earlier In 2010 there was particular table in search db where it used to store the search suggestion but here I cannot find such thing 
    Any help on how to debug will be appreciated 

    You can create a search center site, and set the search center site to
    allow anonymous access.
    Also see this link - http://blog.mastykarz.nl/search-query-suggestions-anonymous-users-sharepoint-2013-mavention-query-suggestions/ 
     (As this is regarding a 3rd party tool, I suggest that you direct it to the  provider support.)
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • No query rewriting in a star schema

    Gentlemen,
    I am facing a problem with query rewriting in a simple data warehouse star schema. I want to take advantage of the built-in roll up along dimensions of a star schema. Therefore, I created several DIMENSIONs and made sure that all foreign key/primary key relationships between fact and dimension tables are set up correctly. In addition, as many table attributes as possible are assigned the NOT NULL constraint, especially the ones that are used by the CHILD Of and ATTRIBUTE relationships.
    I defined materialized views on the fact table and a couple of dimension tables to report on aggregated data. All the MVIEWs are enabled for query rewriting and I have the initialization parameter set correctly (QUERY_REWRITE_INTEGRITY is set to TRUSTED).
    From my tests I learned that a query is rewritten correctly only of the corresponding MVIEW contains the fact table and one dimension table. This is true for every dimension I created. However, as soon as the MVIEW joins more than one dimension table to the fact table the rewriting mechanism fails. It appears that the roll-up (aggregation along the hierarchy) is only possible for one of the dimensions. If the original query suggests rolling-up more than one dimension (e.g., "summarize the key figures by year and product category" but the underlying dimension is based on month and product), the MVIEW is no longer rewritten at all.
    Do you know this effect from your work experience? Is this a bug or have I made a mistake or forgotten to switch on a special feature?
    Here are some technical data of our data warehouse: we are running an Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 on a Windows Server 2003, the size of the database is about 10 GB (excluding indexes), the star schema contains ten dimension tables each one with a simple or parallel hierarchies (e.g. a product dimension). The fact table and the MVIEWS are partitioned by month.
    Any help is very welcome.
    Regards,
    John

    Hi,
    you may ask with DBMS_MVIEW why your query does not get rewritten:
    Maybe you have to create a util table first with
    SQL> @?/rdbms/admin/utlxrw.sql
    Then you ask:
    SQL> begin
    DBMS_MVIEW.EXPLAIN_REWRITE('<your query without ; at the end>');
    end;
    The reason why it is not rewritten:
    SQL> select message from rewrite_table order by sequence;
    Kind regards
    Uwe

Maybe you are looking for

  • How to view cc files on a computer that only has photoshop cs6

    I have the new version of photoshop on my computer that only allows me to save files as: photoshop cc.  However, I would like to transfer these files to view on a computer, which is at school, that only allows me to view files from photoshop cs6 or o

  • SCCM 2012 SP1 - OS Deployment - hash could not be matched for the downloded content

    I've got a newly deployed SCCM 2012 SP1 running on Windows Server 2012. The W2K12 runs as vm on ESX 5.1. I'm having very odd issues with OS deployment. The TS keeps failing when processing SCCM client installation - it downloads the package but then

  • Help - import own classes in jsp

    Hey guys.. I'm working on a Shopping cat project which is in the directory - C:\Tomcat 6\webapps\ROOT\cart I've written one code in shop-product.jsp as below - <%@ page language = "java" contentType = "text/html"          import = "ShoppingBasket, Pr

  • Help with the code

    Hi all, i have records like in internal table itab id      amount 101  1  1.00 101  2  2.00 102  1  1.00 102  2  2.50 102  3  3.00 103  2  1.50 i want the output like like this internal table itab1 101  3.00 102  6.50 103  1.50   clear : wa_zoritem ,

  • " Waiting for approval " until when !????

    Hi  i have a nokia N8 with the following product code 059D1M2 im always checking for the update realase , now its been a month evryday i check the updates availability i find " Waiting for approval"  is nokia joking on us or  what !!?