How I can eliminate commas in a concatenation when the records is not there

I am getting these results
Holly Eliza Congdon, 2002, Son, John Harvey , 1981, other, , ,
Peter Allen, 1966, other, Duke Beardsley , 1992, other, , ,
Nellie Wood, 2011, Son, , , , , ,
Shawn Burns, 1986, other, , , , , ,
Jay Taylor, 1977, , , , , , ,
William Travis Stoll, 2013, Son, , , , , ,
Mary Beth Cockerham, 1982, , , , , , ,
Alice Tower Knapp, 1981, , Chris Tower Zafren , 1975, other, Dana Rose Tower, 2012, other
Jahd Khalil, 2011, Son, , , , , ,
Lauren Scott, 2009, other, , , , , ,
Danielle Restuccia, 2008, other, , , , , ,
I want to be able to NOT display the , , , , , (commas) if the record have only one relative
this records has 3
Alice Tower Knapp, 1981,Mother , Chris Tower Zafren , 1975, Other, Dana Rose Tower, 2012, Other
looks fine
but this one:
Jahd Khalil, 2011, Son, , , , , ,      LEG     09/20/2009 10:55:46
Only one, how I can eliminate the , , , , , ?
Here is the query:
SELECT spriden_pidm, 201090, '1', '1',
                   szcasup_relative1_name
                || ', '
                || szcasup_relative1_class
                || ', '
                || decode(szcasup_relative1_relation,'S','Siblings','O','Other','M','Mother','F','Father')
                || ', '
                || szcasup_relative2_name
                || ' , '
                || szcasup_relative2_class
                || ', '
                || decode(szcasup_relative2_relation,'S','Siblings','O','Other','M','Mother','F','Father')
                || ', '
                || szcasup_relative3_name
                || ', '
                || szcasup_relative3_class
                || ', '
                ||decode(szcasup_relative3_relation,'S','Siblings','O','Other','M','Mother','F','Father'),
                'LEG', SYSDATE
           FROM saturn_midd.szcasup, saturn.spriden
          WHERE spriden_ntyp_code = 'CAPP'
            AND szcasup_common_appl_id = spriden_id
            AND szcasup_relative1_name IS NOT NULLEdited by: peace4all on Sep 20, 2009 8:18 AM
Edited by: peace4all on Sep 20, 2009 8:18 AM

Maybe, but if there are trailing blanks
SELECT REGEXP_REPLACE('Jahd Khalil , 2011 , Son , , , , , , LEG 09/20/2009 10:55:46',' ,', '') FROM DUAL;
you need to take care of that first:
Jahd Khalil 2011 Son LEG 09/20/2009 10:55:46 <-- no commas at all!
1 row selected.
I guess there are many ways, and the old REPLACE is more than capable.
WITH dummydata AS (SELECT   'A' one,
                            'B' two,
                            NULL three,
                            'D' four
                     FROM   DUAL)
SELECT   one || ', ' || two || ', ' || three || ', ' || four record
  FROM   dummydata
UNION ALL
SELECT   REPLACE (record, ', ,', ',') record
  FROM   (SELECT   one || ', ' || two || ', ' || three || ', ' || four record
            FROM   dummydata)
UNION ALL
SELECT      one
         || CASE WHEN two IS NULL THEN '' ELSE ', ' END
         || two
         || CASE WHEN three IS NULL THEN '' ELSE ', ' END
         || three
         || CASE WHEN four IS NULL THEN '' ELSE ', ' END
         || four
            record
  FROM   dummydata

Similar Messages

  • How do I "eject" camera from iPhoto app when the icon is not visible in the left-hand column?

    The "eject" icon is not visible so I'm concerned about just unplugging my camera from the USB portal.  I think it could wipe out the existing files on the card.

    If your camera mounts to the desktop uyou can dismount it from the finder
    LN

  • Re: Why can't I have a raincheck when the ad does not say limited quantities?

    Not the same person, but is it possible to get a rain check for this deal whether it is online or in store? The games I wanted to buy are out in both options.

    Hello everyone,
    This promotion created some serious demand for the games involved. However, it also created some confusion around the topic of rainchecks. I apologize if this confusion made for a poor experience for any of you while trying to take advantage of this offer. In this post, I hope to shed some light on this for all of you.
    I understand that since we did not specifically call out in our weekly ad insert whether or not this promotion qualified for rainchecks, it was somewhat ambiguous to anyone that hasn’t dealt with this specific situation before. One of the exclusions to a raincheck is when the model is not specifically advertised with a price (e.g., “All TVs on Sale”). In this case, it was advertised, “Buy One Get One Free on these 3DS titles”. I am very sorry to hear that this might not have been explained to you by the store.
    We are grateful for you interest in this promotion and your desire to bring us your business. Please let us know if you have other questions or concerns.
    Best regards,
    JD|Social Media Specialist | Best Buy® Corporate
     Private Message

  • Why can't I have a raincheck when the ad does not say limited quantities?

    On the buy one get one DS games it does not say while supplies last or quantities limited.

    Hello DianaHahn,
    It's always good to request a raincheck when possible to take advantage of good deals. I'm sorry to hear you were not able to obtain one for the DS games you want to purchase. Were you trying to purchase them in store or on BestBuy.com? 
    Thank you,
    Maria|Social Media Specialist | Best Buy® Corporate
     Private Message

  • I can not eliminate ASK engine from the list. It came back by itself. Please, tel me how I can eliminate this problem. Another problem, this browser is no longer compatible with some institutions. This new version might have some problems.

    '''I can not eliminate ASK engine from the list. It came back by itself. Please, tel me how I can eliminate this problem.
    Another problem, this browser is no longer compatible with some institutions. .'''

    Step by step, how did you arrive at seeing this agreement?

  • HT4910 A question I would like to know how I can eliminate old backup in I Cloud so I can have more space

    I would like to know how I can Eliminate my old backup, so I can have more space for new storage

    You can delete it by going to Settings>iCloud>Storage & Backup>Manage Storage, tap the device you want to delete the backup for under Backups, then tap Delete Backup.  Note: be absolutely sure you no longer need to the backup for anything as once deleted you can't get it back.

  • How do I eliminate one of two librarys in the itunes store

    How do I eliminate one of two librarys in the itunes store

    What do you mean by two libraries ? Do you mean two iTunes store accounts ? If so then any content that you've bought/downlaoded via each account will remain tied to that account and it can't be copied or transferred to a different account - if you haven't bought or downloaded anything with one of the accounts then don't use that account and just use the other one from now on. If you mean something else ... ?

  • Is there another way of getting apps from the appstore without putting your credit card number in, ive heard about the itunes gift card thing can anybody just give me more info about that and how i can buy free things free things from the appstorepls help

    Is there another way of getting apps from the appstore without putting your credit card number in, ive heard about the itunes gift card thing can anybody just give me more info about that and how i can buy free things free things from the appstore...pls help as im only a teenager and have no credit credit and my parents dont trust me with theres and they dont care about the fact that you can set up a password/.... PLEASE SOMEONE HELP I WILL BE SO GRATEFUL... And i would really like to get the iphone 4 but if there is no way of etting apps without your credit number then i would have to get a samsung galaxy s3 maybe ...

    You can set up an Apple ID without a credit card.
    Create iTunes Store account without credit card - Support - Apple - http://support.apple.com/kb/ht2534

  • How can I print just a part of the page and not the full page with Adobe Reader v 10.1.2?

    how can I print just a part of the page and not the full page with Adobe Reader v 10.1.2? I need to print a engineering print with lot of information but information is too small in letter size and I don't have a plotter.

    Two ways to print a portion of a page: zooming or using the Snapshot Tool.
    ZOOMING:
    Zoom into the area you want to print.
    Click the Print icon.
    Under "Pages to Print", make sure "Current view" is selected under "More options" (you may need to click "More options" to open it).
    If you aren't satisfied with the preview, try clicking "Fit" under the Size button.
    SNAPSHOT
    Choose Edit > Take A Snapshot.
    Drag a rectangle around the area you want to print. 
    Click the Print icon.
    Under "Pages to Print", make sure that "Selected Graphic" is selected under "More options".
    To enlarge the snapshot to fit the sheet of paper, choose "Fit" under the Size button.
    Hope this helps!

  • HT201363 My iPhone, iPad and iPod are all associated with the same Apple ID.  How can I remove the iPod and associate it with a new Apple ID without affecting the data on the other devices (note: there is no data on the iPod I want to keep)?

    My iPhone, iPad and iPod are all associated with the same Apple ID.  How can I remove the iPod and associate it with a new Apple ID without affecting the data on the other devices (note: there is no data on the iPod I want to keep)?

    Very simple.  Turn off Find my iDevice, then  Tap Settings, General, Erase, Erase all content and settings.

  • How I can delete my account from Itunes Store? [I am not using it anymore and will not]]

    How I can delete my account from Itunes Store? [I am not using it anymore and will not]

    Just stop using it and remove your payment info.
    There is no need to do more.

  • I don't know what I did, but Aperture no longer sees my HD as online, and I can't get my photo versions since the HD is not online. I see it in Finder, but Aperture no longer recognizes it. Does someone know how to fix this?

    I don't know what I did, but Aperture no longer sees my HD as online, and I can't get my photo versions since the HD is not online. I see it in Finder and can see the original files and even copy them from Finder, but Aperture no longer recognizes the HD, and when I try to work with the picture, it doesn't let me because it says that the master is in a volume that's offline. Does someone know how to fix this?

    Just to clarify:
    Does Aperture not see the drive at all (that is, does Aperture also not see the drive in the import and export dialogue) or are only the Master Files disconnected?
    If Aperture does not recognize the drive at all, check the permission settings of the drive in the "Get Info" panel and make sure you have read/write access, also the "Ignore ownership on this volumn" checkmark, this should be set.
    If correcting the permissions does not help, make sure you have a backup, and then use "Disk Utility" to run a check and to repair the volumn, if necessary.
    If Aperture can see the drive on import and export, but only does not see the master image files, then try to reconnect your masters.
    Create a smart album or use a Search with the rule: "File status: offline", to select all images that need reconnecting to their masters.
    Right click on the first image of the selection.
    From the Pop-up window select "Locate referenced Files..."
    Now the "Reconnect All" button should appear.
    Click it.

  • When i burn videos to a dvd-r disc it works on my macbook but not on a windows/pc or my dvd player. How can i make it work on all the above and not just a mac product?

    when i burn videos to a dvd-r disc it works on my macbook but not on a windows/pc or my dvd player. How can i make it work on all the above and not just a mac product?

    Unfortunately, the recording & movie industry does not respect the rights of the people who make them money, and thus you can only use the paid-for content in ways they see fit. Even if I lived in a bunker where no one else could possibly see the movie I paid for, therefor I'm not 'sharing it illegally', I would still not be allowed in a blue moon to copy that movie to DVD for TV viewing. Someone will tell you to get an AppleTV. How about Apple give us one for free? Until this changes, people wanting to use their content in multiple locations will continue to download music & movies via torrents, legally or illegally.

  • I recently lost my iphone to which had of alot purchased music on it, but when i've come to retrieve the music from my itunes and the music is not there?  The purchases show on my history but the music is nowhere?  How can i get my purchases back please?

    I recently lost my iphone to which had of alot purchased music on it, but when i've come to retrieve the music from my itunes and the music is not there?  The purchases show on my history but the music is nowhere?  How can i get my purchases back please?

    By any chance, did you have the Find My iPhone app installed prior to it being stolen?
    Reporting a lost or stolen Apple product
    Hopefully you had your iTunes purchases backed up to an external source such as an external drive or CD's?

  • Hello my name is jose quant, and let me know how I can use CAMERA RAW adobe bridge because the bridge use and want to open a camera raw image, I get a message that says: MAIN BRIDGE aplicaion NOT ACTIVATED. BRIDGE REQUIRES A PARTICULAR PRODUCT HAS BEGUN A

    Hello my name is jose quant, and let me know how I can use CAMERA RAW adobe bridge because the bridge use and want to open a camera raw image, I get a message that says: MAIN BRIDGE aplicaion NOT ACTIVATED. BRIDGE REQUIRES A PARTICULAR PRODUCT HAS BEGUN AT LEAST ONCE TO ACTIVATE THIS FEATURE. I wonder what that means?
    I use a lapto (windows 7) 64-Bit operating system.
    Thank you,
    my email is: [email protected], if you send me the answer to my query

    You need to activate Photoshop.
    Mylenium

Maybe you are looking for

  • My iPhone 5 has not been working properly please help!!

    I have a 16GB iPhone 5 with the latest update (iOS 7.1.2) and lately (about a week or so) it's not been working right. It first started where the screen would freeze and then I'd have to click the power button and return to lock screen I get it to wo

  • Runtime Error in CRM_EVENT_PUBLISH_OW while Sales Order Creation

    Hi, I am getting run time error when I try to copy the sales order from Existing one and Save it. ( in WEB UI) I am getting this error in the Function Module : CRM_EVENT_PUBLISH_OW Code Extract : IF ( iv_obj_name IS INITIAL ) OR     ( iv_guid_hi IS I

  • Cannot view BBC live streaming since late last week

    I could view BBC live video streaming until Friday of last week and it is not working again today == URL of affected sites == http://bbc.co.uk

  • Workflow retriggered for Shopping cart

    Hi ALL, Scenario is like SC created and approved. it was converted to PO and inovice also done. Surprise thing after one month work flow was triggered for this SC. As we know once subsequent documents are created then system will not allow you to ope

  • [svn] 4106: Mostly rename changes.

    Revision: 4106 Author: [email protected] Date: 2008-11-13 17:56:47 -0800 (Thu, 13 Nov 2008) Log Message: Mostly rename changes. IVisualItem -> IVisualElement. IVisualContainer -> IVisualElementContainer. Also changed the APIs so that it's addElement