How can change my code without using if else in procedure

Hai ,
I have wrote code like this
if RPTFORMNTH='M' then
SELECT coalesce(SUM(IN_RWEEKS),0),
INTO C2_COL1
FROM HS_CASEDTA_DTLS_TB
WHERE UPPER(VR_HAUNM) like NVL(case when HAUNM='0' then null else UPPER(HAUNM) END , UPPER(VR_HAUNM))||'%'
AND IN_ULBOBJID=ULBOBJID AND CH_FLAG!='D'
AND VR_RPTFORMNTH=VR_RPTFORMNTH
AND IN_YEAR=IN_YEAR;
ELSE
SELECT
coalesce(SUM(IN_RWEEKS),0),
INTO C2_COL1
FROM HS_CASEDTA_DTLS_TB
WHERE UPPER(VR_HAUNM) like NVL(case when HAUNM='0' then null else UPPER(HAUNM) END , UPPER(VR_HAUNM))||'%'
AND IN_ULBOBJID=ULBOBJID AND CH_FLAG!='D'
AND
TO_DATE(('01/'||VR_RPTFORMNTH||'/'||IN_YEAR),'DD/MM/YYYY')
BETWEEN to_date('04/' || to_char(RPTYEAR-1),'MM/YY')
AND add_months(to_date(RPTFORMNTH || to_char(RPTYEAR),'MonYYYY'),1)-1;
END IF;
My query is without using if else and replicate data in if and else how can i modify code.Observe that only where condition i want changes that's why i used if else without that how can i modify where clause with that two conditions.Please give me guidance.
Regards ,
rajendar.

hi,
I think you want your condition to change inside the where clause so you could have only one select statement. If that is so try this:
SELECT coalesce(SUM(IN_RWEEKS),0),
INTO   C2_COL1
FROM   HS_CASEDTA_DTLS_TB
WHERE  1 = CASE WHEN RPTFORMNTH='M' THEN
                CASE WHEN UPPER(VR_HAUNM) like NVL(case when HAUNM='0' then null else UPPER(HAUNM) END , UPPER(VR_HAUNM))||'%'
                          AND IN_ULBOBJID=ULBOBJID AND CH_FLAG!='D'
                          AND VR_RPTFORMNTH=VR_RPTFORMNTH
                          AND IN_YEAR=IN_YEAR
               THEN 1
                     ELSE 0
                END
           ELSE --  RPTFORMNTH !='M'
                CASE WHEN UPPER(VR_HAUNM) like NVL(case when HAUNM='0' then null else UPPER(HAUNM) END , UPPER(VR_HAUNM))||'%'
                          AND IN_ULBOBJID=ULBOBJID AND CH_FLAG!='D'
                          AND TO_DATE(('01/'||VR_RPTFORMNTH||'/'||IN_YEAR),'DD/MM/YYYY')
                          BETWEEN to_date('04/' || to_char(RPTYEAR-1),'MM/YY')
                          AND add_months(to_date(RPTFORMNTH || to_char(RPTYEAR),'MonYYYY'),1)-1
                     THEN 1
                     ELSE 0
                END
           ENDMessage was edited by:
Bobbydj
hi Are, after belatedly reading Rob's post, I think his post is better. I was only looking at your highlighted code, but he took the most common conditions inside the where clause.

Similar Messages

  • Hello! I'm out of the country and all my iWeb information is on my computer at home. Now I need to make changes on the webpage... how can i do that without using the computer i made the page on? Thank you!!

    Hello! I'm out of the country and all my iWeb information is on my computer at home. Now I need to make changes on the webpage... how can i do that without using the computer i made the page on? Thank you!!

    iWeb uses the domain.sites2 files to store its assets.
    You'll find it here :
    ~/Library/Application Support/iWeb/
    where ~ is your Home directory.
    If you take a computer with you, you have to store that file in the same location.
    It's not different from taking documents with you if you want to edit them.
    A solution is to remotely control your computer at home.
    TeamViewer, LogMeIn, Apple Remote Desktop or any VNC application you can use, like "Chicken of the VNC".

  • Due to a divorce all my music is on my iTunes and iPod. I had to buy a new computer and want to transfer my Library to the new computer. How can I do this without using an external drive and use new computer just like I do the old one? Thanks.

    Due to divorce, all my music is on my iTunes and iPod. I have had to buy  a new laptop and want to transfer the library to the new computer before deauthorizing the old one. I dont want to have to use an external drive every time I want to listen to my music. How can I do this and have the same basic iTunes setup as before? HELP!

    You might consider itunes match for moving CDs you've copied into your itunes library if you dont have a way to use home sharing.
    iTunes match is an optional service offered by apple that costs about $25 a year.  It scans your music library and if it finds music that is already in apple's itunes catalog it'll automatically "unlock"/"store" these in the cloud for you.  Items that it does not find in the catalog it'll upload and store these in the cloud for you and you can download them on your devices.  See http://www.apple.com/itunes/itunes-match/

  • HT4972 I tried updating My device but I was unable to how can I do that without using a pc

    I tried updating my iTunes to the 10.6 version but it would not allow me to.  It also would not update ios5 either what should I do?  How can I download for free?

    Try:'
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    or
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP

  • How can I pay purchases without using credit card in India?

    I'm living in India. I don't have a credit card. Please help me how can I  pay my purchases on iTunes Store by any other method. I have a net banking account and a debit card??? Please help...

    Accepted form of payment
    http://support.apple.com/kb/HT5552

  • How to change row colour without using WDTableCellDesign

    Hi
    I change the row colour of my tree table depending on the level of the tree.
    WDTableCellDesign doesn't have the colours that I want.
    I want to use different shades of blue.
    How do i do this?
    I have a variable of type type     com.sap.ide.webdynpro.uielementdefinitions.TableCellDesign which I change with WDTableCellDesign elements.
    Is there another type that I can use?

    Anton,
    You may only used limited(?) set of standard table cell designs.
    Alternatevily, you must create complete WD theme using Theme Editor.
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

  • Im creating a Digital magazine using InDesign. How can I publish it without using DPS?

    Hi there,
    I feel really stupid asking this question.
    But Im creating a digital magazine for a school project and I only need to publish it or view it on an Ipad just for the marker who is looking at it, Can see how it works and Can mark it. Is there anyway I can go about doing that without purchasing the DPS. As its alot of money and I dont wish to buy it just to put this one magazine on an Ipad. Its just for my final yearlie school project. So again I dont see the point of purchasing it just for this one project, In which I will never use it again...
    Thank you.

    As long as you have the Adobe DPS tools installed (Folio Builder and Folio Overlays), and you have a free Adobe ID, you can create folios and can view them on your iPad. You can share them with another person who has an Adobe ID. You cannot publish the folio on the Apple App Store without a Creative Cloud subscription, or by purchasing the rights to publish a Single Edition app.
    For further questions, please ask on the Adobe DPS forum:
    Digital Publishing Suite

  • How can I import photos without using iPhoto?

    I'm 37, a lifetime PC/Windows user and have finally made the switch to Mac after years of using every other Apple product, including iPod, iPhone and Apple TV, which, by the way, must be the most under-marketed and best value Apple product ever. I can't believe more people don't have Apple TV in their homes.
    With PCs, I was used to importing pictures to my hard drive and then viewing and editing them with whatever software applications I wanted. With my Mac, I notice that when I insert my SD card, iPhoto starts and asks me to import, which I agree. Unfortunately, it imports the images to an iPhoto folder that I can't easily access from another program, such as PhotoshopElements. I have read how to use Finder to navigate to these imported images in the iPhoto library ("Show Package Content") and then I copy the folder of images and paste it to a folder in my "Pictures" directory in Finder, but I find this tedious and also redundant as I now I understand I basically have two copies of every image, one for iPhoto Library and the other for accessing via other programs, such as Photoshop.
    Is there anyway I can simply import images straight to a folder on my hard drive?
    Also, if I do choose to access these images via iPhoto, am I correct in assuming iPhoto will automatically create a duplicate folder, just for accessing in the iPhoto library? If so, isn't this a waste of hard drive space? Can this be avoided?
    Thank you for any and all assistance.
    Kevin

    Hi Kevin,  I am in the same boat as you having been buying PCs for the last 25 years and managing IT for SMEs I have now purchased my first Mac (mac mini).  My move to Mac started with the iPhone that led to the iPad then like you I succumbed to the beauty of the Apply TV that then led to the purchase of an Airport Express.  The love affair had to conclude in the purchase of a Mac! 
    For many years I have used the feature to have the date photos taken created as a folder and all photos from that date placed in that folder.  Every year I create a new folder for that year and the import on PC creates the daily folders to hold photos …
    I was just about to ask how I can keep doing this and realised it’s not as important as I thought – I’ll still create a folder for each year and just have the photos dumped in there.  I can sort in Finder by date taken and catalogue in any way I won’t.
    I’ll still use folders rather than iPhoto as I want other software like XBMC (on other OS)  to read the photos.
    Thanks for letting me rant – I thought I will post anyway as this is my first Apple post and it may assist others.

  • How can same vendor code be used for domestic & import purchases?

    Hi
    We have a vendor who was initially supplying domestic goods but now we are also going to import goods from him.
    The Client doesnt want two separate vendor codes since they cannot get composite balance for domestic as well as for imports under one vendor code.
    I do understand we cannot have two different Reconcilliation accounts for one vendor code even and if we have just one reconcilliation account we cannot bifurcate domestic and foreign purchases.
    Please suggest.
    Regards
    Kapil

    Hi,
    It is not possible to change the reconciliation account (SpGL or alternative account) in MIRO transaction. Of course you can make some modifications in MIRO in order to open for changes field "G/L account" on "Details" screen, but if you should not foget to modify MR8M.
    Another alternative is to repost the MIRO documents (vendor oen items) to the alternative reconcilation account with FB01.
    Regards,
    Svetlin

  • How can I bluetooth sync without using iCal

    Hi, I have a Macbook Pro with Bluetooth, and a Palm Tungsten e2. I would really like to sync using bluetooth, but after I followed all the advice on the Mac support page (which configured my iSync), to my dismay I discovered I was syncing with iCal, not my Palm desktop. For several reasons I prefer Palm desktop to to iCal, so my question is:
    Can I do a bluetooth sync, from my Palm to my Mac, and have it work with Palm desktop, rather than iCal and it's associated Address book?
    BTW, I found all my disabled conduits and returned them to my original Palm folder, and I switched my prefs back to good ol' USB, and everything seems back to normal.
    One day iCal might impress me enough to switch over, but I haven't seen the magic yet.
    thanks, Shereen

    Certainly. I presume that you are synchronizing now via USB to the Palm Desktop?
    As long as you have already paired your organizer with your computer, you are ready to initiate Bluetooth synchronization, though you might want to double check the settings in the HotSync Manager on both the organizer and the computer to insure that the proper software 'mechanism' is enabled.
    Be sure that the iSync Palm Conduit—which appears in the HotSync Manager as iSync Conduit and in the Finder as simply Apple—is not active.

  • How can I write code that uses schemas returned by one query to run another

    I need to use the data returned by this SQL
    Select owner
    From dba_tables
    Where tablename = 'TRANSACT';
    To run the following SQL for every schema in the database:
    Select $vschema, count(*)
    from $vschema..transact;
    Where I am using $vschema as a variable to hold owners returned by the first statement.
    I have tried using 1 cursor, 2 cursors, 1 coursor and an execute immediate command and either my code fails or I get a message that it ran successful but I cant see the data that I want returned by the second query.

    I don't actually want to get the count on the transact table for each schema I just used that as an example to simplify... Maybe the code that I have written so far would be better... Here is one attempt:
    SET SERVEROUTPUT ON SIZE 1000000
    SET VERIFY OFF
    DECLARE
    v_schema Varchar2(50);
    v_chgdate DATE;
    v_debits NUMBER(14,4);
    v_amount NUMBER(14,2);
    /* First cursor */
    CURSOR get_schemas (v_schema OUT char) IS
    SELECT DISTINCT t.owner
    FROM sys.dba_tables t
    WHERE t.table_name = 'GERCVLOG'
    ORDER BY t.owner;
    /* Second cursor */
    CURSOR get_stats (v_schema IN char) IS
    SELECT MAX(g.chgdate),
    SUM(g.debits),
    SUM(g.totalamt)
    FROM &&v_schema..gercvlog g
    WHERE g.chgdate >= '01-Jan-07' or
    g.chgdate = (SELECT MAX(g1.chgdate)
    FROM &&v_schema..gercvlog g1);
    BEGIN
    /* Open first cursor*/
    OPEN get_schemas (v_schema OUT char);
    LOOP
    FETCH get_schemas INTO v_schema;
    EXIT WHEN get_schemas%NOTFOUND;
    dbms_output.put_line('Schema: '||v_schema);
    OPEN get_stats (v_schema IN char);
    LOOP
    FETCH get_stats INTO v_chgdate, v_debits, v_amount;
    FETCH get_schemas INTO v_schema;
    EXIT WHEN get_stats%NOTFOUND;
    dbms_output.put_line('Latest Import: '||v_chgdate);
    dbms_output.put_line('Total Debits: '||v_debits);
    dbms_output.put_line('Total Dollars: '||v_amount);
    dbms_output.put_line('______________________________');
    END LOOP;
    CLOSE get_stats;
    END LOOP;
    CLOSE get_schemas;
    END;
    /

  • I had start over just like getting a new computer, one thing, i lost mail and iphoto, but my daughter has it on her's.  how can i get it without using the start disk, because i don't have one.

    how do i get back mail and iphoto?

    Mail should be there, have you looked in the Aplications folder?

  • I want to buy IPHONE as present but the person does not use a MAC , how can u update software without using MAC

    Any tips on how to do the above , thanks

    You do not need a MAC.  Why do you thing this is true.
    Do they have a  PC?
    Apple ID (required for some features)
    Internet access6
    Syncing with iTunes on a Mac or PC requires:
    Mac: OS X v10.5.8 or later
    PC: Windows 7; Windows Vista; or Windows XP Home or Professional with Service Pack 3 or later
    iTunes 10.5 or later (free download fromwww.itunes.com/download)

  • HT1918 Created an apple I'd using a wrong e-mail address. Can't access the e-mail to varify the Apple ID in order to be able to change the account settings. Any idea how can change the account information without having to varify the account through the e

    Created an apple I'd using a wrong e-mail address. Can't access the e-mail to varify the Apple ID in order to be able to change the account settings. Any idea how can change the account information without having to varify the account through the e-mail?

    You are trying to find a loophole to circumvent a basic rule that prohibits the transfer of purchased content from one Apple ID to another.
    Content tied to an Apple ID are bound to that Apple ID forever. You can not merge or trade accounts. Well, not (officially) anyway...

  • How can i install any program using java code

     
    Hi friends,
    i want to know how can i install any software using c# code.

    Hi,
    You may change your title, Since this is C# forum.
     >>i want to know how can i install any software
    usingc# code
    So what kind of your software?
    In C#,we can install and uninstall "*.msi" files (setup).
    The code to install software without user interface is:
    private void installSoftware()
    Process p = new Process();
    p.StartInfo.FileName = "msiexec.exe";
    p.StartInfo.Arguments = "/i \"C:\\Application.msi\"/qn";
    p.Start();
    For more detailed information, please refer to article
    C# - Installing and uninstalling software in codeproject.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for

  • History Report

    Dear all As per requirements i have mostly completed the PM history report, which comprises Equipments specifications, BOM. Additionally i have to add the very important tasks, spares , Cost of operation also. Here we couldnt consider all the operati

  • I can no longer play videos on my Mac mini.

    I got a new magic mouse for Christmas. I connected it to my Mac mini Lion. It works great but I can no longer play videos like from YouTube. I just see a black screen. Even the start triangle does not show up. This is date coincident with installing

  • Create a summary based on a response to a given question

    Hi. I use this to collect data on my students. I have 2 sections of students, M and R (Monday and Thursday) and they all answer the same questions (one of which is to indicate their section.) While I do want to see a report summary that has data on a

  • Can't pair Motorola H500 to 1stGen iPhone

    I just bought a Motorola H500 bluetooth headset and for some reason my iPhone can't/won't see it to pair to it. Any suggestions?

  • Nested styles

    I'm using nested styles in one of my documents. Specifically, I'm creating a long schedule and putting the times in a different font than the meeting names. Works great visually, but I've noticed that the nested style isn't *actually* changing the ch