Count(*) that is conditioned and then case statement of result

Hi: This is table_1 :
with Table_1
as
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') incident_date, 2005 Policy_no  from dual
      union all
      select to_date('04-MAR-2009 12:12','DD-MON-YYYY HH24:MI') incident_date, 2009 Policy_no  from dual
      union all
      select to_date('25-JUL-2010 23:30','DD-MON-YYYY HH24:MI') incident_date, 2013 Policy_no  from dual
select * from Table_1
with Table_2
as
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 100 agr_line_no, 'BIKE' object  from dual
      union all
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 200 agr_line_no, 'BUCKS'  from dual
      union all
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 300 agr_line_no, 'CELL'  from dual
      union all
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 400 agr_line_no, 'CAR'  from dual
      union all
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 500 agr_line_no, 'HOUSE'  from dual
      union all
      select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 100 agr_line_no, 'BIKE' object  from dual
      union all
      select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 200 agr_line_no, 'BUCKS'  from dual
      union all
      select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 300 agr_line_no, 'BEACH'  from dual
      union all
      select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 400 agr_line_no, 'CAR'  from dual
      union all
      select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 500 agr_line_no, 'HOUSE'  from dual
      union all
      select to_date('20-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('29-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2013 Policy_no, 676 agr_line_no, 'CAR'  from dual
select * from Table_2I need to perform a count(*) on agr_line_no for the condition that there are other objects other than 'CAR' ie so forpolicy_no = 2005 the count must be 4.
Table_1 must join to table_2 on Policy_no and all columns in table_1 must be selected as well as an additional column called Object_many.
Object_many is based on the count(*) from table_2 ie if the count is > 1 then 'Y' must be returned else 'N'
Also there must be a where clause ie where table_1.incident_date is between table_2 .cover_start_date and table_2 .cover_end_date
Final Result Should look something like this
with Table_1
as
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') incident_date, 2005 Policy_no, 'Y' Object_many from dual
      union all
      select to_date('04-MAR-2009 12:12','DD-MON-YYYY HH24:MI') incident_date, 2009 Policy_no, 'Y' Object_many from dual
      union all
      select to_date('25-JUL-2010 23:30','DD-MON-YYYY HH24:MI') incident_date, 2013 Policy_no, 'N' Object_many from dual
select * from Table_1Thanks in advance!!
Banner:
Oracle Database 11g Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production

with Table_1
as
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') incident_date, 2005 Policy_no  from dual
      union all
      select to_date('04-MAR-2009 12:12','DD-MON-YYYY HH24:MI') incident_date, 2009 Policy_no  from dual
      union all
      select to_date('25-JUL-2010 23:30','DD-MON-YYYY HH24:MI') incident_date, 2013 Policy_no  from dual
), Table_2
as
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 100 agr_line_no, 'BIKE' object  from dual
      union all
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 200 agr_line_no, 'BUCKS'  from dual
      union all
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 300 agr_line_no, 'CELL'  from dual
      union all
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 400 agr_line_no, 'CAR'  from dual
      union all
      select to_date('01-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('04-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2005 Policy_no, 500 agr_line_no, 'HOUSE'  from dual
      union all
      select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 100 agr_line_no, 'BIKE' object  from dual
      union all
      select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 200 agr_line_no, 'BUCKS'  from dual
      union all
      select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 300 agr_line_no, 'BEACH'  from dual
      union all
      select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 400 agr_line_no, 'CAR'  from dual
      union all
      select to_date('01-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('09-MAR-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2009 Policy_no, 500 agr_line_no, 'HOUSE'  from dual
      union all
      select to_date('20-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_start_date, to_date('29-JUL-2009 20:10','DD-MON-YYYY HH24:MI') Cover_end_date, 2013 Policy_no, 676 agr_line_no, 'CAR'  from dual
-- end-of-test-data
select
table_1.policy_no,
max(table_1.incident_date) incident_date,
case when count(table_2.agr_line_no) > 1 then 'Y' else 'N' end object_many
from table_1
left outer join table_2
   on table_2.policy_no = table_1.policy_no
   and table_2.cover_start_date <= table_1.incident_date
   and table_2.cover_end_date >= table_1.incident_date
   and table_2.object != 'CAR'
group by
table_1.policy_no
order by
table_1.policy_no;I have assumed policy_no to be primary key in Table_1 - therefore max(table_1.incident_date) will work.
If you have an index on Table_2 on the cover dates then the above construction might be better than a between. Otherwise between will be quite OK ;-)

Similar Messages

  • Conditional Filters using case statements

    Hello,
    I have a table view which displays Total Quota and Theatre Quota. Against the Total Quota, there are 2 values - Rollover Revenue and Theatre Revenue. Against the Theatre Quota, there is only Theatre Revenue.
    What I want to accomplish is to display only the Rollover Revenue Aggregated Quarterly number whenever there is a Total Quota number and not display the Theatre Revenue number
    In the table view,
    Year Name     Quarter Name     Quarter Name Sort     Person Region     Quota Name     Quarterly Quota     Credit Amount     QTD Attainment     Credit Type Name
    YEAR-2012     QTR-1-2012     QTR-1-2012     750     Total Quota     6,128,500     5,492,081     89.62%     Rollover Revenue Aggregated Quarterly
                   750          6,128,500     5,344,000     87.20%     Theatre Revenue
         QTR-2-2012     QTR-2-2012     750     Total Quota     5,922,500     5,890,264     99.46%     Rollover Revenue Aggregated Quarterly
                   750          5,922,500     6,120,000     103.33%     Theatre Revenue
         QTR-3-2012     QTR-3-2012     750     Total Quota     5,716,500     0     0.00%     
         QTR-4-2012     QTR-4-2012     750     Total Quota     5,510,500     0     0.00%     
    I used an example in the following link:
    http://oraclebizint.wordpress.com/2008/02/06/oracle-bi-ee-101332-conditional-filters-using-case-statements-in-filters/
    and applied the example in my scenario:
    CASE WHEN Quota."Quota Name" = 'Total Quota' THEN "Credit Type"."Credit Type Name" ELSE 'Dummy' END != 'Theatre Revenue'
    I still get duplicate rows.
    Thanks.

    Could you suggest any solutions for this problem where I can conditionally hide the number only for a certain type of data and not for all type of data?
    Thanks.

  • Hello sorry but im having a problem with my apple id it appears that i cant download nothing i dont know why but when im going to download something example facebook it appears de app that is charging and then desapere how can i fix that?

    Hello sorry but im having a problem with my apple id it appears that i cant download nothing i dont know why but when im going to download something example facebook it appears de app that is charging and then desapere how can i fix that?

    Hi there,
    I would recommend taking a look at the troubleshooting steps found in the article below.
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970
    -Griff W.

  • When i try to download the newest version of itunes it says "the feature you are trying to use is on a network resource that is unavailable" and then it gives me an alternate path to a folder containing the installation package for itunes64.mis, help

    when i try to download the newest version of itunes it says "the feature you are trying to use is on a network resource that is unavailable" and then it gives me an alternate path to a folder containing the installation package for itunes64.mis, help

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • HT2513 How do you change the name of a reminder in the reminder list.  I right click and then choose "get information"  I can change the colour of the reminder but when I type in the name that I want and then press enter the name stays as "untitled".

    How do you change the name of a reminder in the reminder list.  I right click and then choose "get information"  I can change the colour of the reminder but when I type in the name that I want and then press enter the name stays as "untitled"

    Jerry,
    Thanks for replying again. I've got a little bit further thanks to you. I tried the US keyboard layout as you seemed pretty definte that it should work. This time I applied the setting and also started the language toolbar and selected it from there.
    Hey presto, I've got the @ where it should be. Excellent.
    However the single quote ' works in a weird way. When I press it, it doesn't show up on the screen. But when I press another key, I get the single quote plus the next key I press. When I press the single quote twice, I get 2 of them. This is also the same with the SHIFT ' key. i.e. for the double quotes.
    Very strange. I'll look at other keyboards and see where that gets me.
    Thanks,  Maz

  • I wish to restory my iPhone 4s to the original factory condition and then restore my apps. Can I do this?

    I want to restore my iPhone 4s to the original factory condition and then restore my apps. Can this be accomplished?
    Thanks.
    PRSNRS

    Dear Allan,
    Thanks. My main concern is whether my apps will be restored. Will they be available from the synch/backup?
    I am considering wiping my iPhone 4s because of one main problem. For some reason I receive, for example, 15 notices of a birthday reminder. I'm sure I made a bad choice somewhere, but cannot figure it out.
    Thanks.
    PRSNRS

  • My work phone number has an extension. Can I input the number so that it pauses and then dials the extension?

    My work phone has an extension. Can I input the number ito my contacts so that it pauses and then dials the extension?

    Please see thread https://discussions.apple.com/thread/4329335?start=0&tstart=0
    Pause and Wait doesnt work wiht Iphone 5 with ios 6.0

  • Checking for the condition types using case statement

    hi folks,
    I have a lot of condition types that I have to check for and I am using case statement to do that. The code goes like this.
    case wac-kschl.
            when 'ZRAT' OR 'ZAGR' OR 'ZRCR' OR
                  'Y098' OR 'Y007' OR 'ZREW' OR 'Y106'        OR 'ZTSR' OR 'Y127' OR 'Y125' OR 'Y126' OR 'Y124' OR 'Y157' OR 'Y092' OR 'Y085' OR 'Y090' OR 'ZMZD'
    OR 'Y215' OR 'Y214' OR 'Y111' OR 'ZC$D' OR 'ZAUD'.
    up till here it is working on errors and when I add few more condition types to the case statement it is throwing the error.
    I have to check for all the condition types out here.
    How can I correct it? Is there a better way to do it?
    thanks
    Santhosh

    Hi Santhosh,
    I think that your CASE statement has a flaw. The line length of one of the lines is too large. You need to insert a carriage-return to shorten it (or press the button 'Pretty Printer').
    The code would look nicer like this:[code]  CASE wac-kschl.
        WHEN 'ZRAT' OR 'ZAGR' OR 'ZRCR' OR 'Y098' OR 'Y007' OR 'ZREW'
          OR 'Y106' OR 'ZTSR' OR 'Y127' OR 'Y125' OR 'Y126' OR 'Y124'
          OR 'Y157' OR 'Y092' OR 'Y085' OR 'Y090' OR 'ZMZD' OR 'Y215'
          OR 'Y214' OR 'Y111' OR 'ZC$D' OR 'ZAUD' OR 'Z001' OR 'Z002'
          OR 'Z003' OR 'Z004' OR 'Z005' OR 'Z006' OR 'Z007' OR 'Z008'
          OR 'Z009' OR 'Z010' OR 'Z011' OR 'Z012' OR 'Z013' OR 'Z014'.
        Do your thing here
          WRITE: / 'OK'.
        WHEN OTHERS.
          WRITE: / 'NOT OK'.
      ENDCASE.[/code]If this will not work for you, you could try a different approach:[code]* Local definition
      DATA:
        var_list(1024).
    Build variable string for checking
      CONCATENATE 'ZRAT ZAGR ZRCR Y098'
                  'Y007 ZREW Y106 ZTSR'
                  'Y127 Y125 Y126 Y124'
                  'Y157 Y092 Y085 Y090'
                  'ZMZD Y215 Y214 Y111'
                  'ZC$D ZAUD'
             INTO var_list
        SEPARATED BY space.
    Check if the correct value is supplied
      IF var_list CS wac-kschl.
      Do your thing here
        WRITE: / 'OK'.
      ENDIF.[/code]Hope this helps you a bit.
    Regards,
    Rob.

  • Check a condition and then put the transaction as read-only

    Hello people,
    I need to make a check in Purchase Order (ME21N and ME23N), so that when the user enter in transaction, I will check if the invoice was registered and then put the purchase order in "read only" state.
    How do you suggest me to do it?
    Loop at screen? Is there a state flag to set?
    Thanks a lot!!!

    Hi,
    I didn't get your requirement correctly. When using ME21N, your purchase order is not yet created. What is the meaning of set the T-code in display mode only for the PO? ME23N is already display only T-code. If you are refering to ME22N, then probably you can think of a custom T-code where you can call ME22N/23N based on the check.
    Thanks,
    Vinod.

  • Offline form in iPad DPS App that stores data and then sends when connected to internet

    Hi there,
    I've built an "app" using InDesign and DPS. Great, whiz bang 360 spins, video, etc, etc but at the end I would like to have a form to record the users experience on the ipad or to record their experience of an event where the iPad was used. I have created a form in Acrobat XI, exported to FormCentral as a trial, linked to the form using a web frame within InDesign and then exporting out with DPS. App works fine, can see form, enter data and submit, check data via FormCentral admin system, all good.
    However, is it possible to create the same app that works identically offline? I know the whiz bang stuff will work as it's built into the standalone app. I guess the html form will need to be stored locally, when a user submits the form it needs to write to the iPad and store locally and if/when the iPad makes a connection to the internet it can send the stored local data upto FormCentral for processing. The form would be filled in by multiple users at different times.
    From trawling the web I can see forms can write locally to the iPad but then I also see pages of code, my eyes glaze over and I run for the hills. I just wondered if there was an easy solution? If not, can this be raised as an item in the wishlist for both FormCentral/DPS/Indesign? A nice clicky interface for us "non-coding" designers.
    Any help would be most appreciated,
    Thanks,
    Rog.

    Hi Randy,
    Thanks for coming back to me on this. Instead of a html form, can a pdf form embedded within a DPS app work?
    I see that pdf forms can be filled in offline and data sent went back online but unsure as to whether this approach will work within a DPS app.
    I saw a post you responded to
    http://forums.adobe.com/message/3506205#3506205
    You mention an article to the offline form in more detail but I get a broken link.
    Thanks again.

  • 11g outer join with case statement - strange results.

    Hello All,
    I am experiencing a strange issues in 11g while using case statement.
    I am not able to reproduce this using sample data. Not sure what is wrong.
    I am not narrowing it to say the usage of case statemnt is giving wrong results, but that is my observation when I am doing trail and error testing.
    Here are the details.
    My Version
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    SQL> My Query
    SELECT *
      FROM (SELECT DISTINCT mf.schedule,
                            mf.cptcode,
                            NVL (mf.modifier, '00') modifier2,
                            CASE
                               WHEN mf.feetype = 'H'
                                AND mf.multiplier IS NOT NULL THEN
                                  '      0.00'
                               WHEN (mf.feetype != 'H'
                                  OR  mf.feetype IS NULL)
                                AND mf.rbrvsvalue IS NOT NULL
                                AND mf.multiplier IS NOT NULL THEN
                                  LPAD ( TRIM (TO_CHAR ( (mf.rbrvsvalue * mf.multiplier) / 100, 9999999.99)), 10)
                               ELSE
                                  NULL
                            END
                               fee
              FROM provider.mpifee mf, mpi_udffee.udffeeactivecptcodes vld
             WHERE mf.schedule = 'SAPG1'
               AND mf.cptcode = vld.cptcode
               AND NVL (mf.modifier, 'NULL') = NVL (vld.modifier, 'NULL')) inline_fee,
           (SELECT arc.schedule col1, arc.procedurecode col2, NVL (arc.modifier, '00') AS col3
              FROM mpi_udffee.udffeeancfeedata arc
             WHERE monthofextract = '201202'
               AND arc.schedule = 'SAPG1'
               AND TRUNC (SYSDATE - 10) BETWEEN arc.recordeffectivedate AND arc.recordterminationdate) inline_data
    WHERE inline_fee.schedule = inline_data.col1(+)
       AND inline_fee.cptcode = inline_data.col2(+)
       AND inline_fee.modifier2 = inline_data.col3(+);
    In the above query the inline view inline_data returns zero rows. but NVL is still getting applied for col3 and I am getting 00 in the results( strange ).
    Results:
    SCHEDULE        CPTCO MODIFIER2  FEE             COL1  COL2  COL3
    SAPG1           49590 00             667.32                  00
    SAPG1           49611 00             781.03                  00
    SAPG1           49905 00             443.79                  00
    SAPG1           50205 00             883.56                  00
    SAPG1           50220 00            1315.15                  00
    SAPG1           50230 00            1638.74                  00
    SAPG1           50234 00            1666.16                  00
    SAPG1           50250 00            1566.14                  00
    SAPG1           50327 00             262.04                  00
    SAPG1           50541 00            1183.31                  00
    SAPG1           50620 00            1156.88                  00
    SAPG1           50650 00            1321.96                  00
    497 rows selected.
    Just the inline view inline_data,
    SQL> SELECT arc.schedule col1, arc.procedurecode col2, NVL (arc.modifier, '00') AS col3
      2            FROM mpi_udffee.udffeeancfeedata arc
      3           WHERE monthofextract = '201202'
      4             AND arc.schedule = 'SAPG1'
      5             AND TRUNC (SYSDATE - 10) BETWEEN arc.recordeffectivedate AND arc.recordterminationdate;
    no rows selectedMuch unusual thing is when I just remove the case statement from the inline view "inline_fee", I am getting right results,
    SELECT *
      FROM (SELECT DISTINCT mf.schedule,
                            mf.cptcode,
                            NVL (mf.modifier, '00') modifier2          <-- Removed Case statement here
              FROM provider.mpifee mf, mpi_udffee.udffeeactivecptcodes vld
             WHERE mf.schedule = 'SAPG1'
               AND mf.cptcode = vld.cptcode
               AND NVL (mf.modifier, 'NULL') = NVL (vld.modifier, 'NULL')) inline_fee,
           (SELECT arc.schedule col1, arc.procedurecode col2, NVL (arc.modifier, '00') AS col3
              FROM mpi_udffee.udffeeancfeedata arc
             WHERE monthofextract = '201202'
               AND arc.schedule = 'SAPG1'
               AND TRUNC (SYSDATE - 10) BETWEEN arc.recordeffectivedate AND arc.recordterminationdate) inline_data
    WHERE inline_fee.schedule = inline_data.col1(+)
       AND inline_fee.cptcode = inline_data.col2(+)
       AND inline_fee.modifier2 = inline_data.col3(+);
    SCHEDULE        CPTCO MODIFIER2  COL1  COL2  COL3
    SAPG1           46730 00
    SAPG1           46735 00
    SAPG1           46748 00
    SAPG1           46760 00
    SAPG1           46942 00
    SAPG1           46945 00
    SAPG1           47015 00
    SAPG1           47125 00
    SAPG1           47350 00
    SAPG1           47505 00
    SAPG1           47553 00interestingly explain plan for both the statements are exactly same,
    SELECT STATEMENT  ALL_ROWSCost: 138  Bytes: 1,078,274  Cardinality: 11,471                                
         9 HASH JOIN RIGHT OUTER  Cost: 138  Bytes: 1,078,274  Cardinality: 11,471                           
              2 PARTITION RANGE EMPTY  Cost: 2  Bytes: 150  Cardinality: 3                      
                   1 TABLE ACCESS FULL TABLE MPI_UDFFEE.UDFFEEANCFEEDATA Cost: 2  Bytes: 150  Cardinality: 3                 
              8 VIEW MPI_UDFFEE. Cost: 135  Bytes: 504,724  Cardinality: 11,471                      
                   7 HASH UNIQUE  Cost: 135  Bytes: 539,137  Cardinality: 11,471                 
                        6 HASH JOIN  Cost: 134  Bytes: 539,137  Cardinality: 11,471            
                             3 TABLE ACCESS FULL TABLE MPI_UDFFEE.UDFFEEACTIVECPTCODES Cost: 13  Bytes: 177,345  Cardinality: 25,335       
                             5 PARTITION LIST SINGLE  Cost: 120  Bytes: 600,600  Cardinality: 15,015  Partition #: 8       
                                  4 INDEX RANGE SCAN INDEX (UNIQUE) REPRICE.PK_MPIFEE Cost: 120  Bytes: 600,600  Cardinality: 15,015  Partition #: 9  Partitions accessed #11Is there anything wrong with the query? If not have anyone come across this issue or posted it as a bug or is there a patch?
    Update:
    when I set the parameter "_complex_view_merging"=false I am getting the right results even with case statement. But I don want to do some thing unsupported.
    Are there any other viable solutions?
    I appreciate the help.
    Thanks,
    G.
    Edited by: Ganesh Srivatsav on Apr 10, 2012 12:37 PM

    Hi Tubby,
    Right, the query transformation is going wrong. Following is from trace,
    SELECT "INLINE_FEE"."SCHEDULE" "SCHEDULE",
           "INLINE_FEE"."CPTCODE" "CPTCODE",
           "INLINE_FEE"."MODIFIER2" "MODIFIER2",
           "INLINE_FEE"."FEE" "FEE",
           "ARC"."SCHEDULE" "COL1",
           "ARC"."PROCEDURECODE" "COL2",
           CASE
              WHEN "ARC".ROWID IS NOT NULL THEN NVL ("ARC"."MODIFIER", '00')
              ELSE NULL
           END
              "COL3"
      FROM (SELECT DISTINCT "MF"."SCHEDULE" "SCHEDULE",
                            "MF"."CPTCODE" "CPTCODE",
                            NVL ("MF"."MODIFIER", :B2) "MODIFIER2",
                            CASE
                               WHEN ("MF"."FEETYPE" = :B3
                                 AND "MF"."MULTIPLIER" IS NOT NULL) THEN
                                  :B4
                               WHEN ( ("MF"."FEETYPE" <> :B5
                                    OR  "MF"."FEETYPE" IS NULL)
                                 AND "MF"."RBRVSVALUE" IS NOT NULL
                                 AND "MF"."MULTIPLIER" IS NOT NULL) THEN
                                  LPAD ( TRIM (TO_CHAR ( "MF"."RBRVSVALUE" * "MF"."MULTIPLIER" / :B6, :B7)), :B8)
                               ELSE
                                  NULL
                            END
                               "FEE"
              FROM "PROVIDER"."MPIFEE" "MF", "MPI_UDFFEE"."UDFFEEACTIVECPTCODES" "VLD"
             WHERE "MF"."SCHEDULE" = 'SAPG1'
               AND "MF"."CPTCODE" = "VLD"."CPTCODE"
               AND NVL ("MF"."MODIFIER", 'NULL') = NVL ("VLD"."MODIFIER", 'NULL')) "INLINE_FEE",
           "MPI_UDFFEE"."UDFFEEANCFEEDATA" "ARC"
    WHERE "INLINE_FEE"."SCHEDULE" = "ARC"."SCHEDULE"(+)
       AND "INLINE_FEE"."CPTCODE" = "ARC"."PROCEDURECODE"(+)
       AND "INLINE_FEE"."MODIFIER2" = CASE
                                         WHEN ("ARC".ROWID(+) IS NOT NULL) THEN NVL ("ARC"."MODIFIER"(+), '00')
                                         ELSE NULL
                                      END
       AND "ARC"."MONTHOFEXTRACT"(+) = '201202'
       AND "ARC"."SCHEDULE"(+) = 'SAPG1'
       AND TRUNC (SYSDATE-10) >= "ARC"."RECORDEFFECTIVEDATE"(+)
       AND TRUNC (SYSDATE-10) <= "ARC"."RECORDTERMINATIONDATE"(+)Does this refer to a specific bug?
    Thanks,
    G.

  • Help with setting a condition (if-then-else statements)

    Hello,
    In the following data template I am trying to create a condition for
    SUMAMOUNTPERKELEASE when cs_countfund > 1 in my rtf template.
    <dataTemplate dataSourceRef="xmlpdemo" name="cs_ar_kelease">
         <dataQuery>
              <sqlStatement name="Q_1">
                   <![CDATA[
    select     fm.ke
    ,     ltrim(to_char(fm.ke,'000')) || '-'
    ||     ltrim(to_char(fm.lease#,'000000')) || '-'
    ||     ltrim(to_char(fm.lse_code,'00')) kelease
    ,     fm.ar_doc# ar_doc
    ,     fd.fund
    ,     fd.sub
    ,     ro.lname
    ,     fm.billed_from
    ,     fm.billed_thru
    ,     fm.due_date
    ,     sum(decode(trancode,
              10, fd.amount,
              420, fd.amount,
              421, fd.amount,
              100, fd.amount*-1,
              101, fd.amount*-1,
              102, fd.amount*-1,
              109, fd.amount*-1,
              110, fd.amount*-1,
              112, fd.amount*-1,
              120, fd.amount*-1,
              121, fd.amount*-1,
              122, fd.amount*-1,
              130, fd.amount*-1,
              230, fd.amount*-1,
              0 )) amount
    from     finhist_main fm
    ,     rolodex ro
    ,     finhist_detail fd
    where     fd.fund <> 999
    and     fd.sub <> 99
    and     fm.status not in (106,110,120)
    and     fd.trancode <> 11
    and     fm.ar_doc# < 9000000
    and     fm.rolodex# = ro.rolodex#
    and     fm.lse_code = fd.lse_code
    and     fm.lease# = fd.lease#
    and     fm.ke = fd.ke
    and     fm.ar_doc# = fd.ar_doc#
    group by     fm.ke
    ,     fm.lease#
    ,     fm.lse_code
    ,     fm.ar_doc#
    ,     fd.fund
    ,     fd.sub
    ,     ro.lname
    ,     fm.billed_from
    ,     fm.billed_thru
    ,     fm.due_date
    order by     fm.ke, fm.lease#, fm.lse_code
    ,     fm.ar_doc#
    ,     fd.fund
    ,     fd.sub
    ]]>
              </sqlStatement>
         </dataQuery>
         <dataStructure>
              <group name="G_ke" dataType="varchar2" source="Q_1">
                   <element name="ke" dataType="number" value="KE"/>
                   <element name="SumamountPerke" function="sum" dataType="number" value="G_fund.amount"/>
                   <group name="G_kelease" dataType="varchar2" source="Q_1">
                        <element name="kelease" dataType="varchar2" value="KELEASE"/>
                        <element name="ar_doc" dataType="number" value="AR_DOC"/>
                        <element name="lname" dataType="varchar2" value="LNAME"/>
                        <element name="billed_from" dataType="date" value="BILLED_FROM"/>
                        <element name="billed_thru" dataType="date" value="BILLED_THRU"/>
                        <element name="due_date" dataType="date" value="DUE_DATE"/>
                        <element name="CS_countfund" function="count" dataType="number" value="G_fund.fund"/>
                        <element name="SumamountPerkelease" function="sum" dataType="number" value="G_fund.amount"/>                    <group name="G_fund" dataType="varchar2" source="Q_1">
                             <element name="fund" dataType="number" value="FUND"/>
                             <element name="sub" dataType="number" value="SUB"/>
                             <element name="amount" dataType="number" value="AMOUNT"/>
                        </group>
                   </group>
              </group>
         </dataStructure>
    </dataTemplate>
    <element name="CS_countfund" function="count" dataType="number" value="G_fund.fund"/>
    <element name="SumamountPerkelease" function="sum" dataType="number" value="G_fund.amount"/>     
    I have tried the following conditions in the text form field for SUMAMOUNTPERKELEASE
    <?if:cs_countfund > 1?>
    SUMAMOUNTPERKELEASE
    <?end if?>
    <?xdofx: if :cs_countfund > 1 then
    SUMAMOUNTPERKELEASE end if?>
    <?xdofx: if cs_countfund > 1 then
    SUMAMOUNTPERKELEASE end if?>
    <?choose:?>
    <?when: cs_countfund > 1?>
    SUMAMOUNTPERKELEASE
    <?end when?>
    Nothing seems to work. Help...
    Any suggestions would be greatly appreciated.
    Susie

    Hi,
    I assume that in your resulting XML CS_countfund is written in uppercase.
    So try
    <?if:CS_COUNTFUND > 1?>
    <?SUMAMOUNTPERKELEASE?>
    <?end if?>
    Regards
    Rainer

  • I have an Ipad2, I didnt have problems to connect wifi in general , except at one library where they asked me to accept terms and conditions and then re start the browser. I tried to close safari with the close gesture but didnt work, wouldnt connect.

    I want to use my ipad in a public library.
    How can I re start a browser session with safari? I need to do this to use wifi in the library. After accepting terms and conditions it ask me to restart all the browser sessions. But with Ipad it doesnt seem to close totally the application.
    Please, help!

    Try a force quit, I don't know if it closes the sessions but it's worth a try...
    When in the app, press on the sleep/wake button until the shutdown screen appears, then press the home button until the app quits.

  • Strange red/purple/magenta "shadow" that goes away and then comes back

    I'm having some issues with a weird discoloration that happens inside of LR. 
    When the file is loaded, it looks like this:
    Once you touch ANY slider (or do anything really), this happens:
    Note the weird red/purple/magenta area around her mouth and cheek.
    Anyone have any ideas what this is and how to stop it from happening?   I've had some suggestions that it might be a moire caused by the texture of the veil but it seems odd that LR had it right to being with.
    Any and all suggestions are greatly appreciated. 
    Thanks. 

    Don’t worry about colors that happen with Fit or Fill, because, for speed, LR uses a fast, inaccurate resampling algorithm and what you’re seeing is likely moiré.   However, if you still see it at 1:1 then that is a problem.  Try reducing the Detail slider in Sharpening to 0 and see if that makes a difference to 1:1.
    If you want you can upload one of these images to www.dropbox.com <http://www.dropbox.com>  and post a public download link to it, here, then when the issue is answered, remove it from your dropbox so it doesn’t stay available forever.

  • My iPad does not recognize my Apple ID. I have reset several times (as requested) it's stated that its successful, and then does not work..I cannot access anything!!!!

    My iPad does not recognize my Apple ID. I have completed a reset several times (as requested).
    The re-set is shown as successful but then doesn't work..I'm locked out of everything!!!

    To change the iCloud ID you have to go to Settings>iCloud, tap Delete Account, provide the password for the old ID when prompted to turn off Find My iDevice, then sign back in with the ID you wish to use.  When you do this you may find that the password for your old ID isn't accepted.  If this should happen, and if your old ID is an earlier version of your current ID, you need to temporarily recreate your old ID by going to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Click edit next to the primary email account, change it back to your old email address and save the change.  Then edit the name of the account to change it back to your old email address.  You can now use your current password to turn off Find My iDevice on your device, even though it prompts you for the password for your old account ID. Then save any photo stream photos that you wish to keep to your camera roll.  When finished go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https://appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.

Maybe you are looking for