Kindly guide me for small query, try to implement the logic of filtering below

Hi all

Ask your kind help in small query below. I need help for Bold Italic clause of the query.

Without bold italics, this query returns 10 records. With below the case diagram, you can understand my concern.

My requirement is to add the three parameters of input as I_PROCESS_ID, I_BASE_CCY, I_SEC_CCY filter.  I'm not able to satisfy the CASE 1. Please guide...

If I put all NULL entries, I get no recording while I need to get all THE records with all three input parameter with null value.

CASEI_PROCESS_IDI_BASE_CCYI_SEC_CCYExpected resultComments
1NULL VALUENULL VALUENULL VALUE10 linesNeed help
2NOT NULLNULL VALUENULL VALUERows filtered on the basis of ID_processusWorks well
3NULL VALUENOT NULLNOT NULLRows filtered on the basis of BASE_CCY & SEC_CCYWorks well

SELECT FT. ID_PROCESSUS,

FT. FEED_DT,

CARD. NORMALIZED_BASE_CCY,

CARD. NORMALIZED_SECONDARY_CCY

OF SAGEDBO. FX_TRANS_REPLICA_90DAYS FT,

(SELECT DISTINCT BASE_CCY, SECONDARY_CCY

OF SAGEDBO. FX_CCY_NORMALIZATION_MAP

) MAP

WHERE PI. BASE_CCY = MAP. BASE_CCY

AND PI. SECONDARY_CCY = MAP. SECONDARY_CCY

AND)

(FT. ID_PROCESSUS = I_PROCESS_ID

OR

(

CARD. BASE_CCY = I_BASE_CCY

AND

CARD. SECONDARY_CCY = I_SEC_CCY

)

)

);

So if the I_... are of non-null values, they should be used to filter the results, but if they are null all results should be returned? Try something like this:

(FT. ID_PROCESSUS = I_PROCESS_ID OR I_PROCESS_ID IS NULL)

AND

((MAP. BASE_CCY = I_BASE_CCY AND MAP. (SECONDARY_CCY = I_SEC_CCY) OR (I_BASE_CCY IS NULL AND I_SEC_CCY IS NULL))

Tags: Database

Similar Questions

  • Support for PIVOT query (or advice on the best way to do it)

    Hi gurus of SQL,.

    I'd appreciate any help you could provide on this request, I'm assuming that the best way to do this would be by using the PIVOT function. I read through some of the documents and books, and done some research here in the forums, but can't seem to find a way to make it work.

    I'm on Oracle 11.1.0.6.0 self.

    I have a table like this:
    ID     Product          Month_A_Amt Month_B_Amt Month_C_Amt     Month_D_Amt
    
    123     ProductA     3          5          7          9
    123     ProductB     2          4          6          8
    123     ProductC     10          11          12          13
    456     ProductA     1          2          3          4
    456     ProductB     3          4          5          6
    We get this data each month - Month_A is always the most recent month, and so it goes back for this game, Month_A is 09 November, Month_B is October 09, Month_C is Sept 09, etc. I'm OK with Hardcoding this value each month, so for the purposes of this exercise, just assume that Month_A is the 09 November, Month_B is Oct 09, Month_C is Sept 09 and Month_D is Aug 09.

    I need essentially "Pivot" in this table, so the end result looks like this:
    ID     Month          Product_A_Amt     Product_B_Amt     Product_C_Amt
    
    123     Nov 09          3          2          10
    123     Oct 09          5          4          11
    123     Sep 09          7          6          12
    123     Aug 09          9          8          13
    456     Nov 09          1          3          null
    456     Oct 09          2          4          null
    456     Sep 09          3          5          null
    456     Aug 09          4          6          null
    Here's the SQL code to create the database with test data table. Now that I've typed this explanation, it still seems easier that I had done it to be... but I'm still confused, so any help is greatly appreciated, thank you!

    create table test_base_table)
    Identification number,
    Product varchar2 (20).
    Number of Month_a_amt
    Number of Month_b_amt
    Number of Month_c_amt
    Number of Month_d_amt);

    insert into test_base_table values (123, "ProductA', 3, 5, 7, 9);
    insert into test_base_table values (123, "ProductB", 2, 4, 6, 8);
    insert into test_base_table values (123, "ProductC", 10, 11, 12, 13);
    insert into test_base_table values (456, 'ProductA", 1, 2, 3, 4);
    insert into test_base_table values (456, 'ProductB', 3, 4, 5, 6);

    Published by: TheBlakester on February 10, 2010 19:56

    Hello

    You don't want to make several clauses UNPIVOT and PIVOT; you want to do several sets of columns in a cluase PIVOT and UNPIVOT one clause.

    In the UNPIVOT clause, it's just a matter of replacing the unique "amt" column before the keyword FOR with a list in parentheses '(amt_1, amt_2)' and the replacement of each column in the list (for example, "month_a_amt") with a list of the same length ("(month_a_amt_1, month_a_amt_2)" ").
    In the PIVOT clause, it's just a matter of replacing the unique "SUM (amt)" aggregate function with a list of unparenthesized of functions, each with an alias ("the SUM (amt_1) AS amt_1, SUM (amt_2) AS amt_2'. The alias that will be added at the end of the givien for names output column in the IN clause.

    SELECT       id
    ,       TO_CHAR ( ADD_MONTHS ( TO_DATE ( 'Nov 2009'
                                            , 'Mon YYYY'
                              )
                          , month_num
                          )
                , 'Mon YYYY'
                )          AS month
    ,       product_a_amt_1
    ,       product_a_amt_2
    ,       product_b_amt_1
    ,       product_b_amt_2
    ,       product_c_amt_1
    ,       product_c_amt_2
    FROM       test_base_table
    UNPIVOT       ( (amt_1,         amt_2      )     FOR month_num IN (
             (month_a_amt_1, month_a_amt_2)     AS  0,
             (month_b_amt_1, month_b_amt_2)     AS -1,
             (month_c_amt_1, month_c_amt_2)     AS -3,
             (month_d_amt_1, month_d_amt_2)     AS -4              )
           )
    PIVOT       ( SUM (amt_1) AS amt_1
           , SUM (amt_2) AS amt_2 FOR product IN ( 'ProductA' AS product_a
                                                        , 'ProductB' AS product_b
                                       , 'ProductC' AS product_c
                                       )
           )
    ORDER BY  id
    ,            month_num     DESC
    ;
    

    Output:

    .              PRODUCT  PRODUCT  PRODUCT  PRODUCT  PRODUCT  PRODUCT
      ID MONTH    _A_AMT_1 _A_AMT_2 _B_AMT_1 _B_AMT_2 _C_AMT_1 _C_AMT_2
    ---- -------- -------- -------- -------- -------- -------- --------
     123 Nov 2009        3        9        2        9       10        9
     123 Oct 2009        5        9        4        9       11        9
     123 Aug 2009        7        9        6        9       12        9
     123 Jul 2009        9        9        8        9       13        9
     456 Nov 2009        1        9        3        9
     456 Oct 2009        2        9        4        9
     456 Aug 2009        3        9        5        9
     456 Jul 2009        4        9        6        9
    

    It looks like all the new values of amt2 are 9. Don't you think it's the best test? I think that different numbers, as you used for the examples of previous data, reduce the chances of getting good results purely by chance.

    If you want to experiment with queries like this, I suggest you use "SELECT *" (nothing added) in the SELECT clause. Start with just an UNPIVOT operation. Some examples in the documentation to do a TABLE CREATION AS... to save the results of an UNPIVOT operator and use this table as the base for a PIVOT table. I think it's a good idea to reduce confusion.

  • Migration of outlook for t-bird, try to import the mail, error "there is no default mail client... ", I confirmed that outlook is the default?

    I'm migrating from Outlook to Thunderbird.

    I bought a new computer with windows 8.

    I copied the data from my old computer outlook file it new computer.

    I installed Thunderbird on my new computer.

    I'm trying to import existing emails stored in Outlook to Thunderbird.

    I get the message "there are no default e-mail client... "I did Outlook as default e-mail client and restarting the computer.

    Is it possible to get the thunderbird recognize the Outlook file?

    Tom

    The automatic import program only works if you have TB and the former program installed on the same computer. If possible, I suggest to install TB on the old computer which currently has Outlook, run the auto import option and then transfer the profile of TB from the old computer to to on the new machine.

    http://KB.mozillazine.org/Move_to_a_new_PC

    The method that I found which is the simplest and most reliable is to copy the folder Thunderbird of the old machine to the new one:

    https://getsatisfaction.com/mozilla_messaging/topics/refinding_my_thunderbird_mail_program#reply_13643805

  • SRA options for small laboratory tests?

    I need to make the Site Recovery Manager basic laboratory tests, to try to get a better grip on it for production deployment.  But, in my lab, I have only low-end NAS services.  I use some servers Linux NFS base for my small lab.

    When you try to implement the SRM, I quickly found that I needed a NAS/SAN with replication storage adapter (SRA) software.    Can anyone recommend low range for SRA options in a lab environment?  Is open source, an option?   How about a low end device certified VMware SAN, as Iomega units?

    Yes, go to the HP Lefthand Networks VSA, it's a virtual appliance, uses almost no RAM (384 MB if I remember correctly), and provide you with disk space.  A couple of those, download the SRA of vmware.com/downloads, follow the left guide to the replication of the installation, and you can have yourself a laboratory MIS in a few hours.  Finally, I checked that they have downloads for workstation and ESX, I've set up labs on both and they worked very well.

    Maybe someone else knows a different "lab" type solution, but it worked for me in the past.

    http://h18006.www1.HP.com/products/storage/software/VSA/index.html

    -alex

  • "Bad Gateway" EA4500 try to access the router after installation the software upgrade

    Hello, I have recently updated my installation software to Version 2.0.14212.1.  I realized that I had to upgrade the installation software before upgrading the Firmware to version 2.1.41 (Build 164606).  However, since the upgrade of the installation software, I could not connect to the router on any browser (Firefox and Chrome).  Instead, I get the error message "-502 Bad Gateway.

    To add to what chadster766 suggested, after pressing the reset button for 30 seconds, try to turn off the router to give him time to rest. After a while, it turns on and plug a PC for it. Try to access the configuration again to 192.168.1.1 page.

    Hope that helps.

  • Any need for allergen hierarchy list instead of the simple list?

    This issue is the community of users more people of the Oracle.  Does anyone else think that allergens and intolerances would be better served by a list of tree hierarchy / instead of simple list that we have today?  I formatted my simple list for English and the limitation that the sorting is alphabetical.  It seems that the sort order is not as logical as it is for English users in some languages.

    Question: Is there a value any to ask this simple list to convert on an enhancement request?

    Example: Our English list becomes the translated list * use Imagination... the idea is that when we try to put the logic in English, it becomes "mixed" on the translations...

    Fish - low

    Fish - tuna

    Dairy products - casein

    Dairy products - Lactose

    Dairy products - whey

    Coconut - almond

    Coconut - pecan nuts

    Walnut - Walnut

    * Imagination goes here...

    Almond

    Bass

    Casein

    Lactose

    Pecans

    Tuna

    Walnut

    Whey

    It seems I'm the only customer looking for something like this.  I changed our allergens to hopefully be more useful for translations.  Discussion response.

  • Rewrite the query, select below or try to get the necessary O/P

    Hello..

    My example of data.,.

    Create table customer (name varchar2 (10), telephone1 telephone2 number (10), number of phone3 (10), (10) number, bitwisephone number (10));

    Insert into customer values('a',23456,67890,null,12345);

    Insert into customer values ('b', 67459,89760,null, 37689);

    create table do_not_call (dont_call number (10));

    insert into do_not_call values (67890);

    insert into do_not_call values (37689);

    Question: -.
    --------------

    Customer 'a' has value of numbers1 as 23456.check if telephone1 exists in the do_not_call table.
    In fact there is no, so set the bit for numbers1 as "o" like wise search telephone2
    & phone3.after update of the bitwisephone for each client should be as the output below.


    Need to O/P: -.
    -------------------

    name bitwisephone

    a 010
    b 001


    For that matter... I use "any" operator...



    SELECT name, case when numbers1 = all (SELECT dont_call FROM do_not_call) and then put an end to '1' other '0'.
    -case when telephone2 = all (SELECT dont_call FROM do_not_call) and then put an end to '1' other '0'.
    -case when phone3 = all (SELECT dont_call FROM do_not_call) then '1' other '0' end 'Bits '.
    OF THE customer;


    Is there any other way to get the necessary O/P?


    Thank you!!

    Kind regards
    VijayRajaram.

    Looks like one already answered Re: rewrite the query, select below or try to get the necessary O/P

    with
    customer(name,phone1,phone2,phone3,bitwisephone) as
    (select 'a',23456,67890,12345,null from dual union all
     select 'b',67459,89760,37689,null from dual
    ),
    do_not_call(dont_call) as
    (select 67890 from dual union all
     select 23456 from dual union all
     select 37689 from dual
    )
    select name,
           to_char(mod(trunc(sum(weight)/4),2))||
           to_char(mod(trunc(sum(weight)/2),2))||
           to_char(mod(sum(weight),2)) bitwisephone
      from (select name,phone1 phone,4 weight
              from customer
            union all
            select name,phone2,2
              from customer
            union all
            select name,phone3,1
              from customer
           ) c,
           do_not_call d
     where c.phone = d.dont_call(+)
       and d.dont_call is not null
     group by name
    

    Please do not duplicate messages

    Concerning

    Etbin

  • I called Amazon to try to recover the serial number of my old iPod classic two weeks ago, and they gave me a kind of account; They pronounce it account 'seen - It '.

    I called Amazon to try to recover the serial number of my old iPod classic two weeks ago, and they gave me a kind of account; They pronounce it account 'seen - It '. I don't have to ask how, because I thought I knew, but I was wrong. Would what type of account be? And how it's spelled? The name of the account is a tiny s followed a 7-digit number. (Of course I will not type the numbers.)

    I would go to a forum for Amazon, because they can be better equipped to answer a question on their system. If synchronize you the device with iTunes, the number can be there in the backup section.  Find the serial number of your Apple - Apple Support product

  • Error message when you try to update the date of birth for child

    My kids already have Apple Id.

    I'll put up the family sharing and added them to the family using their Apple ID.

    The year of birth is not associated with their profile (guess it was not necessary at the time to create the profiles).

    So I try to update the year of birth, following the instructions provided on several Apple Support pages, for example Apple for your child - Apple Support and sharing of the family IDthat says: "If your child already has an Apple ID, you can update their email address, date of birth, Securityand more."  (date of birth = > link: date of birth associated with update to your Apple - Apple Support ID)

    BUT regardless of where and how I'm trying to update the birth year, I get the error message, it can not be updated at the moment...

    (screenshot Danish text)

    How to upgrade to the year of birth? Or when it will be possible to do the update?

    Kind regards

    Michael

    I understand that your child has had to date and that you will allow once you have received approval

  • All-in-one Pavilion 23 23-b034: 2 try to install the solution Center HP for printer HP Pavilion has failed. Screenshots

    I had to do a cover of the factory recently. I can print with the HP C7280 programs smoothly. I got this printer and the solution Center works on this pc before the resumption of the plant and another pc before that.  I tried to install my printer HP all One Printer Solution Center now twice with today fails. I hope that the help of screenshots.

    I 1) downloaded a complete new installation - 2) off all antivirus - 3) restarted and restarted the printer HP - 4) the fact that all windows updates have been applied for windows 8.1 - 5) tried after the provided HP solutions but always with failure. Installation all the way to the final "device configuration"... and then expires. Thanks for any help.

    I ALWAYS KUDO AND MARKED RESOLVED. It is THE RIGHT THING to DO... doncha know. «  :-D
    Find thumbs upward, then click on to a KUDO
    Look to the right and see the OPTIONS to mark ACCEPT as a SOLUTION. Thank you!

    RnrMusicMan: (btw, former musician of Navy for this purpose) I need to send thanks a lot for your answer. I have tried, almost to the point of questioning my sanity, too many times tried too many things and all have failed. Why not go and buy a new printer? Financial considerations. Here's what I've worked with... (finally a good result there, at least the best I know for the moment at the end)

    (1) start here, I have an older HP all C720 printer wireless. I do not think at the moment there is a download of the full version which will allow him to install it in a machine of 8.1. An 8 machine if necessary, but not a 8.1 I do not...? That's what I gathered. Where I made my mistake, so, I was this old horse to battle C7280 installed on my newer HP Pavilion and worked very well with 8.1, (read on before thinking 8.1 work with the C7280) when I say great worked, I mean the Solution Center has worked. Then after a while I improved the Pavilion to 8.1 and everything was fine. A couple of weeks, I had to do a cover of the plant on the HP Pavilion. Instead of installing the software of the printer with the center of solutions right then while he was still an OS 8, I upgraded to 8.1 Loaded my favorite of all the programs and tweaks and tricks. Then I said, I'll install the old workhorse C7280. It would not, not at all, regardless of how many tips I read here, and Googling. Then I tried to install the full version of XP on one of the XP machines. No go. Something I said is prevention. Who could know. I tried to purge the XP what I knew could be related to HP. Shut off all antivirus programs, download fees, etc. etc. ad naseum. I have read and read and tried and failed and failed. You get the drama.

    So, I decided that if I could get it on the Acer Aspire one Netbook I could use as a slave, small sorta Acer server. I barely use the netbook anyway. So I couldn't do. Frustration. So I decided JUST ONE MORE ATTEMPT. And here's what I did for Acer.

    I did a factory restore. No former antivirus autour. Nothing is added. Presitine and already had Service Pack 3 with the resumption of the plant.  What follows I have none to little idea of his touch, but that's what I did.

    (2) I have an old modem that I had used as a slave of my new modem D-Link. I got it, because many of my devices will not work on the new 'n'.  I think, old modem old printer, old BONES. I have set the printer to get the old o SSID of the slave and agreed which has no password. Fortunately, I know anyone personally that could use this wireless slave and they all have their own.

    (3) so once again, I downloaded the full version of XP on the netbook. Extracted, he ran, and so he went the full installation and works.

    That's a lot, but I'm a cheap guy who hates to throw even if old devices, good. I use this Chrome extension called Extension Office remotely in order to get on the netbook from any computer and print using the Solution Center.

    I don't know what I did but I know I've worked. So this is my solution. I'm sure some could find another work around, but probably way above my paygrade.

    Once again, thanks a lot for taking the time. I think I followed your solution several, much too long and did not work. Unless I was always doing something wrong.  My solution was radical but it works for me always try to use these appliances. I just take good care of them and they last. My most recent is the HP Pavilion and it's going on 2 years now.

    Differences or questions please ask. 'Jack :-{D '.

  • I run 10 64-bit Windows and I have used iTunes for years. iTunes installs OK, I disable Norton Firewall during installation. iTunes starts OK, but when I try to access the store down ¾ of the page turns black

    I run 10 64-bit Windows and I have used iTunes for years. iTunes installs OK, I disable Norton Firewall during installation. iTunes starts OK, but when I try to access the store down ¾ of the page turns black, the upper band has Taylor Swift and a few small icons to the bottom of the page. If I type Perry Como, in the search box, the page does not change.

    lysdexic01, I know almost exactly what you describe on my screen of iTunes Store recently updated for Windows 7 64-bit. Only difference is that the icons in the black box are invisible until I move the mouse above them, their location by trial and error. Once activated, the icon remains visible. Each found icon flickers at first, but stops flashing if I pass the mouse over it.

    I think that the store is now functional and useless for those of us experiencing this problem. Other users have reported that their iTunes store screen flickers since they updated iTunes to the latest version, but most did not mention the area big black screen that you and I see.

    So far, Apple seems not to believe that there is a problem with the software to update iTunes. It is therefore important that users continue to report these problems to Apple that there are enough complaints for attention even during a week of office party.

  • I try to install the update of security for Microsoft Office System 2007 (KB972581), but if failed and I get the error code Code 57A__

    I try to install the update of security for Microsoft Office System 2007 (KB972581), but if failed and I get the error code Code 57A

    I have install the 2007 Microsoft Office Suite Service Pack 2

    I bet that if you check the size of the file that has been downloaded it will be probably very small, indicating that it was not downloaded correctly.

    I don't think you have another computer at hand, or a friend with a USB key which may be able to download and copy it for you?  Maybe burn it to a CD or something.

    I could download it and save it to my desktop so I am confident that it is not a problem with the link itself or the file is available for download with success.

    I know this isn't a very good suggestion, but the only other option would be to challenge support and see if a technician can take control of your machine and see if they can solve the problem of internet explore.

    If you find my answer was what you're looking for, remember to click on the box "mark as answer" below!

  • I am trying to make my icons smaller on screen, but when I try to change the No. 1 to 2, a message appears saying Nvidia display Panel Extension can be created?

    I'm at my wits end, trying to make my icons on the smaller desttop, I tried everything but when I try to change the No. 1 to no. 2, which is smaller than a message comes up saying THAT NAVIDIA Display Panel Extension can not be created?

    I checked my drivers and updated if necessary so don't know how to get this sorted out can someone help

    Hello

    Are you try right click on empty office > view > change the size of icons it (use Classic icons for the smaller)?

    Or use your mouse wheel and the Ctrl Key to do so.

    Read the information on this link.

    http://www.mydigitallife.info/how-to-resize-and-change-Vista-desktop-icons-size/

    See you soon.

  • Active Fabric Manager for small deployments.

    I plan on setting up the many Force10 MXL IOM for small deployments under customer prems.  Even AFM sounds like a good way to snap on the default configurations that I can then tweak a little before the deployment.  Anyone used this way AFM?  Did someone use it at all and can offer advice.

    Also, 2 of the 3 PDF files posted on the Wiki for AFM are irreparably damaged.  Is there any hope DELL will replace them with better copies?

    The same PDF files are listed here: http://www.force10networks.com/CSPortal20/KnowledgeBase/Documentation.aspx

    Once again.  Irreparably corrupted... If you try to open them with an overview of firefox.  Open them directly with Adobe Reader works.  It seems that my previous comment was an error.  I have to recant.

  • Getting the error "the device reported unexpected or invalid data for a command. (oxC0AA02FF) when you try to create the system repair disc

    original title: error 0xC0AA02FF

    I try to use a "USB" "cruzer" to create a disc repair system, but when I click on this drive to create it I get the following error message:

    "The device reported unexpected or invalid data for a command.  (oxC0AA02FF)

    Hello

    What method did you follow to create the system repair disc?

    I suggest you to create the system with different USB repair disc and check if it helps.

    Means all try the methods and check them off below if it helps.

    Method 1:

    Try to put the computer in a clean boot state, and then check if it helps.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: After troubleshooting, be sure to set the computer to start as usual as mentioned in step 7 in the above article.

    Method 2:

    I also suggest you to perform check disk (chkdsk) on the computer and see if it helps.

    http://Windows.Microsoft.com/en-us/Windows7/check-a-drive-for-errors

    Note: You may lose a small amount of data while performing the check disk.

    I also inform you that the data on the USB key will be lost. You should take a backup.

    You can also check with the reference article below:

    http://Windows.Microsoft.com/en-us/Windows7/create-a-system-repair-disc

Maybe you are looking for

  • Satellite S2410-303 - looking for the user manual

    I use an old series of Satellite S2410-303.Given that this was sent to me from our headquarters in the company, I don't havethe manual for this machine.I was wondering if I can provide this manual on the net or premisesToshiba services.The locals sai

  • Skype on startup, then crashes

    I'm frustrated and have no idea why Skype has randomly stopped working. Everything was going well until all of a sudden the program started to panic. Then when I opened it, it is literally stopped responding. I tried to restart and it still doesn't w

  • Satellite L555 - 10 M - internal MIC does not work?

    Satellite L555 - 10 M Hello It seems that the internal MIC (beside the web camera) does not work, because I can not save anything.I tried the windows audiorecorder application, Skype application, and one any of them can record my voice. The external

  • connectivity of database without tool

    Is it possible to connect to a SQL database without the database connectivity kit?  I learned that I can create Excel reports without the report generation tool, so I thought that it would be possible?

  • upgrading ram keep getting unrecognized disks check it please message of power cables

    I have hp m9500y elite rinning windows 7 ultimate 64 cant upgrade ram to 8 GB to 16 gig