Spaces when concatenating multiple columns and one column is null - Oracle












6















I need to concatenate several columns into one, with spaces between each value. The problem is when one value is null, I end up with a double space between two values.



Example



SELECT (FIRST_NAME || ' ' || MIDDLE_NAME || ' ' || LAST_NAME
FROM TABLE_A;


If the middle name happens to be NULL, then I end up with two spaces between the first and last name. Any way to get around this and only have one space when there's a null value?










share|improve this question



























    6















    I need to concatenate several columns into one, with spaces between each value. The problem is when one value is null, I end up with a double space between two values.



    Example



    SELECT (FIRST_NAME || ' ' || MIDDLE_NAME || ' ' || LAST_NAME
    FROM TABLE_A;


    If the middle name happens to be NULL, then I end up with two spaces between the first and last name. Any way to get around this and only have one space when there's a null value?










    share|improve this question

























      6












      6








      6


      3






      I need to concatenate several columns into one, with spaces between each value. The problem is when one value is null, I end up with a double space between two values.



      Example



      SELECT (FIRST_NAME || ' ' || MIDDLE_NAME || ' ' || LAST_NAME
      FROM TABLE_A;


      If the middle name happens to be NULL, then I end up with two spaces between the first and last name. Any way to get around this and only have one space when there's a null value?










      share|improve this question














      I need to concatenate several columns into one, with spaces between each value. The problem is when one value is null, I end up with a double space between two values.



      Example



      SELECT (FIRST_NAME || ' ' || MIDDLE_NAME || ' ' || LAST_NAME
      FROM TABLE_A;


      If the middle name happens to be NULL, then I end up with two spaces between the first and last name. Any way to get around this and only have one space when there's a null value?







      oracle null concatenation space






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 14 '12 at 16:36









      dstnrgrsdstnrgrs

      33114




      33114
























          10 Answers
          10






          active

          oldest

          votes


















          -1














          another option is to use decode :



          SELECT decode(FIRST_NAME,'','',FIRST_NAME ||' ') ||
          decode(MIDDLE_NAME,'','',MIDDLE_NAME ||' ') || LAST_NAME
          FROM TABLE_A;





          share|improve this answer


























          • I ended up using the NVL() method you had posted before. I did figure out that the table had some values that were blank (or so I thought) but actually had a space, so those rows were messing with me

            – dstnrgrs
            Aug 14 '12 at 18:05











          • ...I take that back. I had to incorporate the decode as in the above. Thanks for the help

            – dstnrgrs
            Aug 14 '12 at 18:32











          • Since '' is null in Oracle, the nvl calls here add nothing of value. "If FIRST_NAME is null, return null, otherwise return FIRST_NAME" is the same as "return FIRST_NAME".

            – Jeffrey Kemp
            Aug 15 '12 at 4:25











          • Thanks, I've already figured it out(see Tebbe's post)

            – Grisha Weintraub
            Aug 15 '12 at 4:35



















          8














          SELECT TRIM(TRIM(FIRST_NAME || ' ' || MIDDLE_NAME) || ' ' || LAST_NAME)   
          FROM TABLE_A;





          share|improve this answer



















          • 3





            This one is the most correct, as the accepted approach doesn't suppose that the first two arguments could be NULL.

            – g00dy
            Jan 7 '15 at 10:26



















          5














          From the Oracle's documentation:




          CONCAT_WS(separator,str1,str2,...)



          CONCAT_WS() stands for Concatenate With Separator and is a special
          form of CONCAT(). The first argument is the separator for the rest of
          the arguments. The separator is added between the strings to be
          concatenated. The separator can be a string, as can the rest of the
          arguments. If the separator is NULL, the result is NULL.




          And the very important comment:




          CONCAT_WS() does not skip empty strings. However, it does skip any
          NULL values after the separator argument.




          So in your case it should be:



          CONCAT_WS(',', FIRST_NAME, MIDDLE_NAME, LAST_NAME);





          share|improve this answer



















          • 4





            Correct me if I'm wrong but CONCAT_WS() is available in MySQL, not Oracle RDBMS.

            – Erik Anderson
            Mar 16 '16 at 22:54



















          3














          with indata as
          (
          select 'John' as first_name, 'W' as middle_name, 'Smith ' as last_name from dual
          union
          select null as first_name, null as middle_name, 'Adams' as last_name from dual
          union
          select 'Tom' as first_name, null as middle_name, 'Jefferson' as last_name from dual
          )
          select
          regexp_replace(trim(indata.first_name || ' ' || indata.middle_name || ' ' || indata.last_name), 's{2,}', ' ')
          from indata;





          share|improve this answer
























          • ha! just about to post the regexp_replace methodology!

            – Harrison
            Aug 14 '12 at 17:38











          • lol beat you to it ;-)

            – tbone
            Aug 14 '12 at 17:42



















          1














          You could use RPAD() to add in the space character:



          SELECT RPAD(first_name, LENGTH(first_name)+1, ' ')||RPAD(middle_name, LENGTH(middle_name)+1, ' ')||last_name
          FROM TABLE_A;


          When any of the parameters to RPAD are NULL, the result will be NULL, and in Oracle appending NULL to a string returns the original string.






          share|improve this answer































            1














            This is how I typically concatenate several fields and remove whitespace in Oracle:



            TRIM(REGEXP_REPLACE(HOUSE_NO || ' ' || PREFIX || ' ' || STREET_NAME || ' ' || STREET_TYPE || ' ' || SUFFIX, ' +', ' '))




            1. Concatenate all the fields necessary with a space in between each. Empty strings and NULL values will result in a two or more spaces;

            2. Use a regular expression to change any occurrences of multiple spaces [' +'] to a single space [' '];

            3. Finally, trim any whitespace at the beginning and/or end from the resulting string.






            share|improve this answer

































              0














              Yet another option:



              SELECT first_name
              || DECODE(middle_name
              , NULL, NULL
              , ' ' || middle_name)
              || DECODE(last_name
              , NULL, NULL
              , ' ' || last_name) full_name
              FROM table_a
              ;





              share|improve this answer
























              • if middle_name or last_name is empty string (i.e. '') - it doesn't work properly...

                – Grisha Weintraub
                Aug 14 '12 at 17:24






              • 1





                In Oracle it will; Oracle makes no distinction between the empty string and NULL.

                – Tebbe
                Aug 14 '12 at 20:14











              • Wow... I am working with Oracle about a year and didn't know it(worked with MSSQL before). Thanks a lot for your comment it will be useful for me.

                – Grisha Weintraub
                Aug 15 '12 at 3:32



















              0














              Or you could simply use the REPLACE function:



              with indata as 
              (select 'John' as first_name, 'W' as middle_name, 'Smith ' as last_name from dual
              union
              select null as first_name, null as middle_name, 'Adams' as last_name from dual
              union
              select 'Tom' as first_name, null as middle_name, 'Jefferson' as last_name from dual)
              SELECT REPLACE(TRIM(indata.first_name || ' ' || indata.middle_name || ' ' || indata.last_name), ' ', ' ')
              FROM indata


              (And thanks to @tbone for the example data :-)






              share|improve this answer































                0














                I have this work around with example. Hope this helps. Just go to SQL server, select new query and CP following query:



                DECLARE @NULL_SAMLES TABLE
                (
                NS_ID INT IDENTITY(1,1) PRIMARY KEY CLUSTERED NOT NULL
                ,COL_01 VARCHAR(10) NULL
                ,COL_02 VARCHAR(10) NULL
                ,COL_03 VARCHAR(10) NULL
                ,COL_04 VARCHAR(10) NULL
                )

                INSERT INTO @NULL_SAMLES(COL_01,COL_02,COL_03,COL_04)
                VALUES
                ('A','B','C','D')
                ,(' ' ,'B','C','D')
                ,(' ',NULL,'C','D')
                ,('A','B',NULL,'D')
                ,('A','B','C',NULL)
                ,(NULL,'B',NULL,'D')
                ,(NULL,'B','C',NULL)
                ,('A',NULL,'C',NULL)
                ,('A',NULL,NULL,'D')
                ,('A',NULL,NULL,NULL)
                ,(NULL,'B',NULL,NULL)
                ,(NULL,NULL,'C',NULL)
                ,(NULL,NULL,NULL,'D')


                SELECT
                NS.COL_01
                ,NS.COL_02
                ,NS.COL_03
                ,NS.COL_04,
                Stuff(
                Coalesce(', ' + nullif(NS.COL_01, ''), '')
                + Coalesce(', ' + nullif(NS.COL_02, ''), '')
                + Coalesce(', ' + nullif(NS.COL_03, ''), '')
                +Coalesce(', ' + nullif(NS.COL_04, ''), '')
                , 1, 1, '') AS CONC_COLS
                FROM @NULL_SAMLES NS





                share|improve this answer

































                  0














                  Don't underestimate the simple power of the CASE statement, which can be concatenated. Here's a self-contained example you can run as-is:



                  SELECT
                  CASE WHEN x.FIRST_NAME IS NULL THEN x.FIRST_NAME ELSE x.FIRST_NAME || ' ' END ||
                  CASE WHEN x.MIDDLE_NAME IS NULL THEN x.MIDDLE_NAME ELSE x.MIDDLE_NAME || ' ' END ||
                  x.LAST_NAME
                  FROM (SELECT 'John' AS FIRST_NAME, NULL AS MIDDLE_NAME, 'Doe' AS LAST_NAME FROM DUAL) x;





                  share|improve this answer























                    Your Answer






                    StackExchange.ifUsing("editor", function () {
                    StackExchange.using("externalEditor", function () {
                    StackExchange.using("snippets", function () {
                    StackExchange.snippets.init();
                    });
                    });
                    }, "code-snippets");

                    StackExchange.ready(function() {
                    var channelOptions = {
                    tags: "".split(" "),
                    id: "1"
                    };
                    initTagRenderer("".split(" "), "".split(" "), channelOptions);

                    StackExchange.using("externalEditor", function() {
                    // Have to fire editor after snippets, if snippets enabled
                    if (StackExchange.settings.snippets.snippetsEnabled) {
                    StackExchange.using("snippets", function() {
                    createEditor();
                    });
                    }
                    else {
                    createEditor();
                    }
                    });

                    function createEditor() {
                    StackExchange.prepareEditor({
                    heartbeatType: 'answer',
                    autoActivateHeartbeat: false,
                    convertImagesToLinks: true,
                    noModals: true,
                    showLowRepImageUploadWarning: true,
                    reputationToPostImages: 10,
                    bindNavPrevention: true,
                    postfix: "",
                    imageUploader: {
                    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                    allowUrls: true
                    },
                    onDemand: true,
                    discardSelector: ".discard-answer"
                    ,immediatelyShowMarkdownHelp:true
                    });


                    }
                    });














                    draft saved

                    draft discarded


















                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11956844%2fspaces-when-concatenating-multiple-columns-and-one-column-is-null-oracle%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown

























                    10 Answers
                    10






                    active

                    oldest

                    votes








                    10 Answers
                    10






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    -1














                    another option is to use decode :



                    SELECT decode(FIRST_NAME,'','',FIRST_NAME ||' ') ||
                    decode(MIDDLE_NAME,'','',MIDDLE_NAME ||' ') || LAST_NAME
                    FROM TABLE_A;





                    share|improve this answer


























                    • I ended up using the NVL() method you had posted before. I did figure out that the table had some values that were blank (or so I thought) but actually had a space, so those rows were messing with me

                      – dstnrgrs
                      Aug 14 '12 at 18:05











                    • ...I take that back. I had to incorporate the decode as in the above. Thanks for the help

                      – dstnrgrs
                      Aug 14 '12 at 18:32











                    • Since '' is null in Oracle, the nvl calls here add nothing of value. "If FIRST_NAME is null, return null, otherwise return FIRST_NAME" is the same as "return FIRST_NAME".

                      – Jeffrey Kemp
                      Aug 15 '12 at 4:25











                    • Thanks, I've already figured it out(see Tebbe's post)

                      – Grisha Weintraub
                      Aug 15 '12 at 4:35
















                    -1














                    another option is to use decode :



                    SELECT decode(FIRST_NAME,'','',FIRST_NAME ||' ') ||
                    decode(MIDDLE_NAME,'','',MIDDLE_NAME ||' ') || LAST_NAME
                    FROM TABLE_A;





                    share|improve this answer


























                    • I ended up using the NVL() method you had posted before. I did figure out that the table had some values that were blank (or so I thought) but actually had a space, so those rows were messing with me

                      – dstnrgrs
                      Aug 14 '12 at 18:05











                    • ...I take that back. I had to incorporate the decode as in the above. Thanks for the help

                      – dstnrgrs
                      Aug 14 '12 at 18:32











                    • Since '' is null in Oracle, the nvl calls here add nothing of value. "If FIRST_NAME is null, return null, otherwise return FIRST_NAME" is the same as "return FIRST_NAME".

                      – Jeffrey Kemp
                      Aug 15 '12 at 4:25











                    • Thanks, I've already figured it out(see Tebbe's post)

                      – Grisha Weintraub
                      Aug 15 '12 at 4:35














                    -1












                    -1








                    -1







                    another option is to use decode :



                    SELECT decode(FIRST_NAME,'','',FIRST_NAME ||' ') ||
                    decode(MIDDLE_NAME,'','',MIDDLE_NAME ||' ') || LAST_NAME
                    FROM TABLE_A;





                    share|improve this answer















                    another option is to use decode :



                    SELECT decode(FIRST_NAME,'','',FIRST_NAME ||' ') ||
                    decode(MIDDLE_NAME,'','',MIDDLE_NAME ||' ') || LAST_NAME
                    FROM TABLE_A;






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Aug 15 '12 at 4:37

























                    answered Aug 14 '12 at 16:49









                    Grisha WeintraubGrisha Weintraub

                    6,41311438




                    6,41311438













                    • I ended up using the NVL() method you had posted before. I did figure out that the table had some values that were blank (or so I thought) but actually had a space, so those rows were messing with me

                      – dstnrgrs
                      Aug 14 '12 at 18:05











                    • ...I take that back. I had to incorporate the decode as in the above. Thanks for the help

                      – dstnrgrs
                      Aug 14 '12 at 18:32











                    • Since '' is null in Oracle, the nvl calls here add nothing of value. "If FIRST_NAME is null, return null, otherwise return FIRST_NAME" is the same as "return FIRST_NAME".

                      – Jeffrey Kemp
                      Aug 15 '12 at 4:25











                    • Thanks, I've already figured it out(see Tebbe's post)

                      – Grisha Weintraub
                      Aug 15 '12 at 4:35



















                    • I ended up using the NVL() method you had posted before. I did figure out that the table had some values that were blank (or so I thought) but actually had a space, so those rows were messing with me

                      – dstnrgrs
                      Aug 14 '12 at 18:05











                    • ...I take that back. I had to incorporate the decode as in the above. Thanks for the help

                      – dstnrgrs
                      Aug 14 '12 at 18:32











                    • Since '' is null in Oracle, the nvl calls here add nothing of value. "If FIRST_NAME is null, return null, otherwise return FIRST_NAME" is the same as "return FIRST_NAME".

                      – Jeffrey Kemp
                      Aug 15 '12 at 4:25











                    • Thanks, I've already figured it out(see Tebbe's post)

                      – Grisha Weintraub
                      Aug 15 '12 at 4:35

















                    I ended up using the NVL() method you had posted before. I did figure out that the table had some values that were blank (or so I thought) but actually had a space, so those rows were messing with me

                    – dstnrgrs
                    Aug 14 '12 at 18:05





                    I ended up using the NVL() method you had posted before. I did figure out that the table had some values that were blank (or so I thought) but actually had a space, so those rows were messing with me

                    – dstnrgrs
                    Aug 14 '12 at 18:05













                    ...I take that back. I had to incorporate the decode as in the above. Thanks for the help

                    – dstnrgrs
                    Aug 14 '12 at 18:32





                    ...I take that back. I had to incorporate the decode as in the above. Thanks for the help

                    – dstnrgrs
                    Aug 14 '12 at 18:32













                    Since '' is null in Oracle, the nvl calls here add nothing of value. "If FIRST_NAME is null, return null, otherwise return FIRST_NAME" is the same as "return FIRST_NAME".

                    – Jeffrey Kemp
                    Aug 15 '12 at 4:25





                    Since '' is null in Oracle, the nvl calls here add nothing of value. "If FIRST_NAME is null, return null, otherwise return FIRST_NAME" is the same as "return FIRST_NAME".

                    – Jeffrey Kemp
                    Aug 15 '12 at 4:25













                    Thanks, I've already figured it out(see Tebbe's post)

                    – Grisha Weintraub
                    Aug 15 '12 at 4:35





                    Thanks, I've already figured it out(see Tebbe's post)

                    – Grisha Weintraub
                    Aug 15 '12 at 4:35













                    8














                    SELECT TRIM(TRIM(FIRST_NAME || ' ' || MIDDLE_NAME) || ' ' || LAST_NAME)   
                    FROM TABLE_A;





                    share|improve this answer



















                    • 3





                      This one is the most correct, as the accepted approach doesn't suppose that the first two arguments could be NULL.

                      – g00dy
                      Jan 7 '15 at 10:26
















                    8














                    SELECT TRIM(TRIM(FIRST_NAME || ' ' || MIDDLE_NAME) || ' ' || LAST_NAME)   
                    FROM TABLE_A;





                    share|improve this answer



















                    • 3





                      This one is the most correct, as the accepted approach doesn't suppose that the first two arguments could be NULL.

                      – g00dy
                      Jan 7 '15 at 10:26














                    8












                    8








                    8







                    SELECT TRIM(TRIM(FIRST_NAME || ' ' || MIDDLE_NAME) || ' ' || LAST_NAME)   
                    FROM TABLE_A;





                    share|improve this answer













                    SELECT TRIM(TRIM(FIRST_NAME || ' ' || MIDDLE_NAME) || ' ' || LAST_NAME)   
                    FROM TABLE_A;






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 14 '12 at 16:39









                    RedFilterRedFilter

                    134k30242253




                    134k30242253








                    • 3





                      This one is the most correct, as the accepted approach doesn't suppose that the first two arguments could be NULL.

                      – g00dy
                      Jan 7 '15 at 10:26














                    • 3





                      This one is the most correct, as the accepted approach doesn't suppose that the first two arguments could be NULL.

                      – g00dy
                      Jan 7 '15 at 10:26








                    3




                    3





                    This one is the most correct, as the accepted approach doesn't suppose that the first two arguments could be NULL.

                    – g00dy
                    Jan 7 '15 at 10:26





                    This one is the most correct, as the accepted approach doesn't suppose that the first two arguments could be NULL.

                    – g00dy
                    Jan 7 '15 at 10:26











                    5














                    From the Oracle's documentation:




                    CONCAT_WS(separator,str1,str2,...)



                    CONCAT_WS() stands for Concatenate With Separator and is a special
                    form of CONCAT(). The first argument is the separator for the rest of
                    the arguments. The separator is added between the strings to be
                    concatenated. The separator can be a string, as can the rest of the
                    arguments. If the separator is NULL, the result is NULL.




                    And the very important comment:




                    CONCAT_WS() does not skip empty strings. However, it does skip any
                    NULL values after the separator argument.




                    So in your case it should be:



                    CONCAT_WS(',', FIRST_NAME, MIDDLE_NAME, LAST_NAME);





                    share|improve this answer



















                    • 4





                      Correct me if I'm wrong but CONCAT_WS() is available in MySQL, not Oracle RDBMS.

                      – Erik Anderson
                      Mar 16 '16 at 22:54
















                    5














                    From the Oracle's documentation:




                    CONCAT_WS(separator,str1,str2,...)



                    CONCAT_WS() stands for Concatenate With Separator and is a special
                    form of CONCAT(). The first argument is the separator for the rest of
                    the arguments. The separator is added between the strings to be
                    concatenated. The separator can be a string, as can the rest of the
                    arguments. If the separator is NULL, the result is NULL.




                    And the very important comment:




                    CONCAT_WS() does not skip empty strings. However, it does skip any
                    NULL values after the separator argument.




                    So in your case it should be:



                    CONCAT_WS(',', FIRST_NAME, MIDDLE_NAME, LAST_NAME);





                    share|improve this answer



















                    • 4





                      Correct me if I'm wrong but CONCAT_WS() is available in MySQL, not Oracle RDBMS.

                      – Erik Anderson
                      Mar 16 '16 at 22:54














                    5












                    5








                    5







                    From the Oracle's documentation:




                    CONCAT_WS(separator,str1,str2,...)



                    CONCAT_WS() stands for Concatenate With Separator and is a special
                    form of CONCAT(). The first argument is the separator for the rest of
                    the arguments. The separator is added between the strings to be
                    concatenated. The separator can be a string, as can the rest of the
                    arguments. If the separator is NULL, the result is NULL.




                    And the very important comment:




                    CONCAT_WS() does not skip empty strings. However, it does skip any
                    NULL values after the separator argument.




                    So in your case it should be:



                    CONCAT_WS(',', FIRST_NAME, MIDDLE_NAME, LAST_NAME);





                    share|improve this answer













                    From the Oracle's documentation:




                    CONCAT_WS(separator,str1,str2,...)



                    CONCAT_WS() stands for Concatenate With Separator and is a special
                    form of CONCAT(). The first argument is the separator for the rest of
                    the arguments. The separator is added between the strings to be
                    concatenated. The separator can be a string, as can the rest of the
                    arguments. If the separator is NULL, the result is NULL.




                    And the very important comment:




                    CONCAT_WS() does not skip empty strings. However, it does skip any
                    NULL values after the separator argument.




                    So in your case it should be:



                    CONCAT_WS(',', FIRST_NAME, MIDDLE_NAME, LAST_NAME);






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Feb 24 '14 at 21:26









                    Piotr DePiotr De

                    6,80933450




                    6,80933450








                    • 4





                      Correct me if I'm wrong but CONCAT_WS() is available in MySQL, not Oracle RDBMS.

                      – Erik Anderson
                      Mar 16 '16 at 22:54














                    • 4





                      Correct me if I'm wrong but CONCAT_WS() is available in MySQL, not Oracle RDBMS.

                      – Erik Anderson
                      Mar 16 '16 at 22:54








                    4




                    4





                    Correct me if I'm wrong but CONCAT_WS() is available in MySQL, not Oracle RDBMS.

                    – Erik Anderson
                    Mar 16 '16 at 22:54





                    Correct me if I'm wrong but CONCAT_WS() is available in MySQL, not Oracle RDBMS.

                    – Erik Anderson
                    Mar 16 '16 at 22:54











                    3














                    with indata as
                    (
                    select 'John' as first_name, 'W' as middle_name, 'Smith ' as last_name from dual
                    union
                    select null as first_name, null as middle_name, 'Adams' as last_name from dual
                    union
                    select 'Tom' as first_name, null as middle_name, 'Jefferson' as last_name from dual
                    )
                    select
                    regexp_replace(trim(indata.first_name || ' ' || indata.middle_name || ' ' || indata.last_name), 's{2,}', ' ')
                    from indata;





                    share|improve this answer
























                    • ha! just about to post the regexp_replace methodology!

                      – Harrison
                      Aug 14 '12 at 17:38











                    • lol beat you to it ;-)

                      – tbone
                      Aug 14 '12 at 17:42
















                    3














                    with indata as
                    (
                    select 'John' as first_name, 'W' as middle_name, 'Smith ' as last_name from dual
                    union
                    select null as first_name, null as middle_name, 'Adams' as last_name from dual
                    union
                    select 'Tom' as first_name, null as middle_name, 'Jefferson' as last_name from dual
                    )
                    select
                    regexp_replace(trim(indata.first_name || ' ' || indata.middle_name || ' ' || indata.last_name), 's{2,}', ' ')
                    from indata;





                    share|improve this answer
























                    • ha! just about to post the regexp_replace methodology!

                      – Harrison
                      Aug 14 '12 at 17:38











                    • lol beat you to it ;-)

                      – tbone
                      Aug 14 '12 at 17:42














                    3












                    3








                    3







                    with indata as
                    (
                    select 'John' as first_name, 'W' as middle_name, 'Smith ' as last_name from dual
                    union
                    select null as first_name, null as middle_name, 'Adams' as last_name from dual
                    union
                    select 'Tom' as first_name, null as middle_name, 'Jefferson' as last_name from dual
                    )
                    select
                    regexp_replace(trim(indata.first_name || ' ' || indata.middle_name || ' ' || indata.last_name), 's{2,}', ' ')
                    from indata;





                    share|improve this answer













                    with indata as
                    (
                    select 'John' as first_name, 'W' as middle_name, 'Smith ' as last_name from dual
                    union
                    select null as first_name, null as middle_name, 'Adams' as last_name from dual
                    union
                    select 'Tom' as first_name, null as middle_name, 'Jefferson' as last_name from dual
                    )
                    select
                    regexp_replace(trim(indata.first_name || ' ' || indata.middle_name || ' ' || indata.last_name), 's{2,}', ' ')
                    from indata;






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 14 '12 at 17:34









                    tbonetbone

                    11.9k12536




                    11.9k12536













                    • ha! just about to post the regexp_replace methodology!

                      – Harrison
                      Aug 14 '12 at 17:38











                    • lol beat you to it ;-)

                      – tbone
                      Aug 14 '12 at 17:42



















                    • ha! just about to post the regexp_replace methodology!

                      – Harrison
                      Aug 14 '12 at 17:38











                    • lol beat you to it ;-)

                      – tbone
                      Aug 14 '12 at 17:42

















                    ha! just about to post the regexp_replace methodology!

                    – Harrison
                    Aug 14 '12 at 17:38





                    ha! just about to post the regexp_replace methodology!

                    – Harrison
                    Aug 14 '12 at 17:38













                    lol beat you to it ;-)

                    – tbone
                    Aug 14 '12 at 17:42





                    lol beat you to it ;-)

                    – tbone
                    Aug 14 '12 at 17:42











                    1














                    You could use RPAD() to add in the space character:



                    SELECT RPAD(first_name, LENGTH(first_name)+1, ' ')||RPAD(middle_name, LENGTH(middle_name)+1, ' ')||last_name
                    FROM TABLE_A;


                    When any of the parameters to RPAD are NULL, the result will be NULL, and in Oracle appending NULL to a string returns the original string.






                    share|improve this answer




























                      1














                      You could use RPAD() to add in the space character:



                      SELECT RPAD(first_name, LENGTH(first_name)+1, ' ')||RPAD(middle_name, LENGTH(middle_name)+1, ' ')||last_name
                      FROM TABLE_A;


                      When any of the parameters to RPAD are NULL, the result will be NULL, and in Oracle appending NULL to a string returns the original string.






                      share|improve this answer


























                        1












                        1








                        1







                        You could use RPAD() to add in the space character:



                        SELECT RPAD(first_name, LENGTH(first_name)+1, ' ')||RPAD(middle_name, LENGTH(middle_name)+1, ' ')||last_name
                        FROM TABLE_A;


                        When any of the parameters to RPAD are NULL, the result will be NULL, and in Oracle appending NULL to a string returns the original string.






                        share|improve this answer













                        You could use RPAD() to add in the space character:



                        SELECT RPAD(first_name, LENGTH(first_name)+1, ' ')||RPAD(middle_name, LENGTH(middle_name)+1, ' ')||last_name
                        FROM TABLE_A;


                        When any of the parameters to RPAD are NULL, the result will be NULL, and in Oracle appending NULL to a string returns the original string.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Aug 14 '12 at 16:45









                        ninesidedninesided

                        18.9k1373103




                        18.9k1373103























                            1














                            This is how I typically concatenate several fields and remove whitespace in Oracle:



                            TRIM(REGEXP_REPLACE(HOUSE_NO || ' ' || PREFIX || ' ' || STREET_NAME || ' ' || STREET_TYPE || ' ' || SUFFIX, ' +', ' '))




                            1. Concatenate all the fields necessary with a space in between each. Empty strings and NULL values will result in a two or more spaces;

                            2. Use a regular expression to change any occurrences of multiple spaces [' +'] to a single space [' '];

                            3. Finally, trim any whitespace at the beginning and/or end from the resulting string.






                            share|improve this answer






























                              1














                              This is how I typically concatenate several fields and remove whitespace in Oracle:



                              TRIM(REGEXP_REPLACE(HOUSE_NO || ' ' || PREFIX || ' ' || STREET_NAME || ' ' || STREET_TYPE || ' ' || SUFFIX, ' +', ' '))




                              1. Concatenate all the fields necessary with a space in between each. Empty strings and NULL values will result in a two or more spaces;

                              2. Use a regular expression to change any occurrences of multiple spaces [' +'] to a single space [' '];

                              3. Finally, trim any whitespace at the beginning and/or end from the resulting string.






                              share|improve this answer




























                                1












                                1








                                1







                                This is how I typically concatenate several fields and remove whitespace in Oracle:



                                TRIM(REGEXP_REPLACE(HOUSE_NO || ' ' || PREFIX || ' ' || STREET_NAME || ' ' || STREET_TYPE || ' ' || SUFFIX, ' +', ' '))




                                1. Concatenate all the fields necessary with a space in between each. Empty strings and NULL values will result in a two or more spaces;

                                2. Use a regular expression to change any occurrences of multiple spaces [' +'] to a single space [' '];

                                3. Finally, trim any whitespace at the beginning and/or end from the resulting string.






                                share|improve this answer















                                This is how I typically concatenate several fields and remove whitespace in Oracle:



                                TRIM(REGEXP_REPLACE(HOUSE_NO || ' ' || PREFIX || ' ' || STREET_NAME || ' ' || STREET_TYPE || ' ' || SUFFIX, ' +', ' '))




                                1. Concatenate all the fields necessary with a space in between each. Empty strings and NULL values will result in a two or more spaces;

                                2. Use a regular expression to change any occurrences of multiple spaces [' +'] to a single space [' '];

                                3. Finally, trim any whitespace at the beginning and/or end from the resulting string.







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Mar 17 '16 at 21:48

























                                answered Mar 16 '16 at 22:59









                                Erik AndersonErik Anderson

                                2,4902120




                                2,4902120























                                    0














                                    Yet another option:



                                    SELECT first_name
                                    || DECODE(middle_name
                                    , NULL, NULL
                                    , ' ' || middle_name)
                                    || DECODE(last_name
                                    , NULL, NULL
                                    , ' ' || last_name) full_name
                                    FROM table_a
                                    ;





                                    share|improve this answer
























                                    • if middle_name or last_name is empty string (i.e. '') - it doesn't work properly...

                                      – Grisha Weintraub
                                      Aug 14 '12 at 17:24






                                    • 1





                                      In Oracle it will; Oracle makes no distinction between the empty string and NULL.

                                      – Tebbe
                                      Aug 14 '12 at 20:14











                                    • Wow... I am working with Oracle about a year and didn't know it(worked with MSSQL before). Thanks a lot for your comment it will be useful for me.

                                      – Grisha Weintraub
                                      Aug 15 '12 at 3:32
















                                    0














                                    Yet another option:



                                    SELECT first_name
                                    || DECODE(middle_name
                                    , NULL, NULL
                                    , ' ' || middle_name)
                                    || DECODE(last_name
                                    , NULL, NULL
                                    , ' ' || last_name) full_name
                                    FROM table_a
                                    ;





                                    share|improve this answer
























                                    • if middle_name or last_name is empty string (i.e. '') - it doesn't work properly...

                                      – Grisha Weintraub
                                      Aug 14 '12 at 17:24






                                    • 1





                                      In Oracle it will; Oracle makes no distinction between the empty string and NULL.

                                      – Tebbe
                                      Aug 14 '12 at 20:14











                                    • Wow... I am working with Oracle about a year and didn't know it(worked with MSSQL before). Thanks a lot for your comment it will be useful for me.

                                      – Grisha Weintraub
                                      Aug 15 '12 at 3:32














                                    0












                                    0








                                    0







                                    Yet another option:



                                    SELECT first_name
                                    || DECODE(middle_name
                                    , NULL, NULL
                                    , ' ' || middle_name)
                                    || DECODE(last_name
                                    , NULL, NULL
                                    , ' ' || last_name) full_name
                                    FROM table_a
                                    ;





                                    share|improve this answer













                                    Yet another option:



                                    SELECT first_name
                                    || DECODE(middle_name
                                    , NULL, NULL
                                    , ' ' || middle_name)
                                    || DECODE(last_name
                                    , NULL, NULL
                                    , ' ' || last_name) full_name
                                    FROM table_a
                                    ;






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Aug 14 '12 at 17:18









                                    TebbeTebbe

                                    1,183510




                                    1,183510













                                    • if middle_name or last_name is empty string (i.e. '') - it doesn't work properly...

                                      – Grisha Weintraub
                                      Aug 14 '12 at 17:24






                                    • 1





                                      In Oracle it will; Oracle makes no distinction between the empty string and NULL.

                                      – Tebbe
                                      Aug 14 '12 at 20:14











                                    • Wow... I am working with Oracle about a year and didn't know it(worked with MSSQL before). Thanks a lot for your comment it will be useful for me.

                                      – Grisha Weintraub
                                      Aug 15 '12 at 3:32



















                                    • if middle_name or last_name is empty string (i.e. '') - it doesn't work properly...

                                      – Grisha Weintraub
                                      Aug 14 '12 at 17:24






                                    • 1





                                      In Oracle it will; Oracle makes no distinction between the empty string and NULL.

                                      – Tebbe
                                      Aug 14 '12 at 20:14











                                    • Wow... I am working with Oracle about a year and didn't know it(worked with MSSQL before). Thanks a lot for your comment it will be useful for me.

                                      – Grisha Weintraub
                                      Aug 15 '12 at 3:32

















                                    if middle_name or last_name is empty string (i.e. '') - it doesn't work properly...

                                    – Grisha Weintraub
                                    Aug 14 '12 at 17:24





                                    if middle_name or last_name is empty string (i.e. '') - it doesn't work properly...

                                    – Grisha Weintraub
                                    Aug 14 '12 at 17:24




                                    1




                                    1





                                    In Oracle it will; Oracle makes no distinction between the empty string and NULL.

                                    – Tebbe
                                    Aug 14 '12 at 20:14





                                    In Oracle it will; Oracle makes no distinction between the empty string and NULL.

                                    – Tebbe
                                    Aug 14 '12 at 20:14













                                    Wow... I am working with Oracle about a year and didn't know it(worked with MSSQL before). Thanks a lot for your comment it will be useful for me.

                                    – Grisha Weintraub
                                    Aug 15 '12 at 3:32





                                    Wow... I am working with Oracle about a year and didn't know it(worked with MSSQL before). Thanks a lot for your comment it will be useful for me.

                                    – Grisha Weintraub
                                    Aug 15 '12 at 3:32











                                    0














                                    Or you could simply use the REPLACE function:



                                    with indata as 
                                    (select 'John' as first_name, 'W' as middle_name, 'Smith ' as last_name from dual
                                    union
                                    select null as first_name, null as middle_name, 'Adams' as last_name from dual
                                    union
                                    select 'Tom' as first_name, null as middle_name, 'Jefferson' as last_name from dual)
                                    SELECT REPLACE(TRIM(indata.first_name || ' ' || indata.middle_name || ' ' || indata.last_name), ' ', ' ')
                                    FROM indata


                                    (And thanks to @tbone for the example data :-)






                                    share|improve this answer




























                                      0














                                      Or you could simply use the REPLACE function:



                                      with indata as 
                                      (select 'John' as first_name, 'W' as middle_name, 'Smith ' as last_name from dual
                                      union
                                      select null as first_name, null as middle_name, 'Adams' as last_name from dual
                                      union
                                      select 'Tom' as first_name, null as middle_name, 'Jefferson' as last_name from dual)
                                      SELECT REPLACE(TRIM(indata.first_name || ' ' || indata.middle_name || ' ' || indata.last_name), ' ', ' ')
                                      FROM indata


                                      (And thanks to @tbone for the example data :-)






                                      share|improve this answer


























                                        0












                                        0








                                        0







                                        Or you could simply use the REPLACE function:



                                        with indata as 
                                        (select 'John' as first_name, 'W' as middle_name, 'Smith ' as last_name from dual
                                        union
                                        select null as first_name, null as middle_name, 'Adams' as last_name from dual
                                        union
                                        select 'Tom' as first_name, null as middle_name, 'Jefferson' as last_name from dual)
                                        SELECT REPLACE(TRIM(indata.first_name || ' ' || indata.middle_name || ' ' || indata.last_name), ' ', ' ')
                                        FROM indata


                                        (And thanks to @tbone for the example data :-)






                                        share|improve this answer













                                        Or you could simply use the REPLACE function:



                                        with indata as 
                                        (select 'John' as first_name, 'W' as middle_name, 'Smith ' as last_name from dual
                                        union
                                        select null as first_name, null as middle_name, 'Adams' as last_name from dual
                                        union
                                        select 'Tom' as first_name, null as middle_name, 'Jefferson' as last_name from dual)
                                        SELECT REPLACE(TRIM(indata.first_name || ' ' || indata.middle_name || ' ' || indata.last_name), ' ', ' ')
                                        FROM indata


                                        (And thanks to @tbone for the example data :-)







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered Aug 14 '12 at 18:28









                                        Bob JarvisBob Jarvis

                                        33.8k55784




                                        33.8k55784























                                            0














                                            I have this work around with example. Hope this helps. Just go to SQL server, select new query and CP following query:



                                            DECLARE @NULL_SAMLES TABLE
                                            (
                                            NS_ID INT IDENTITY(1,1) PRIMARY KEY CLUSTERED NOT NULL
                                            ,COL_01 VARCHAR(10) NULL
                                            ,COL_02 VARCHAR(10) NULL
                                            ,COL_03 VARCHAR(10) NULL
                                            ,COL_04 VARCHAR(10) NULL
                                            )

                                            INSERT INTO @NULL_SAMLES(COL_01,COL_02,COL_03,COL_04)
                                            VALUES
                                            ('A','B','C','D')
                                            ,(' ' ,'B','C','D')
                                            ,(' ',NULL,'C','D')
                                            ,('A','B',NULL,'D')
                                            ,('A','B','C',NULL)
                                            ,(NULL,'B',NULL,'D')
                                            ,(NULL,'B','C',NULL)
                                            ,('A',NULL,'C',NULL)
                                            ,('A',NULL,NULL,'D')
                                            ,('A',NULL,NULL,NULL)
                                            ,(NULL,'B',NULL,NULL)
                                            ,(NULL,NULL,'C',NULL)
                                            ,(NULL,NULL,NULL,'D')


                                            SELECT
                                            NS.COL_01
                                            ,NS.COL_02
                                            ,NS.COL_03
                                            ,NS.COL_04,
                                            Stuff(
                                            Coalesce(', ' + nullif(NS.COL_01, ''), '')
                                            + Coalesce(', ' + nullif(NS.COL_02, ''), '')
                                            + Coalesce(', ' + nullif(NS.COL_03, ''), '')
                                            +Coalesce(', ' + nullif(NS.COL_04, ''), '')
                                            , 1, 1, '') AS CONC_COLS
                                            FROM @NULL_SAMLES NS





                                            share|improve this answer






























                                              0














                                              I have this work around with example. Hope this helps. Just go to SQL server, select new query and CP following query:



                                              DECLARE @NULL_SAMLES TABLE
                                              (
                                              NS_ID INT IDENTITY(1,1) PRIMARY KEY CLUSTERED NOT NULL
                                              ,COL_01 VARCHAR(10) NULL
                                              ,COL_02 VARCHAR(10) NULL
                                              ,COL_03 VARCHAR(10) NULL
                                              ,COL_04 VARCHAR(10) NULL
                                              )

                                              INSERT INTO @NULL_SAMLES(COL_01,COL_02,COL_03,COL_04)
                                              VALUES
                                              ('A','B','C','D')
                                              ,(' ' ,'B','C','D')
                                              ,(' ',NULL,'C','D')
                                              ,('A','B',NULL,'D')
                                              ,('A','B','C',NULL)
                                              ,(NULL,'B',NULL,'D')
                                              ,(NULL,'B','C',NULL)
                                              ,('A',NULL,'C',NULL)
                                              ,('A',NULL,NULL,'D')
                                              ,('A',NULL,NULL,NULL)
                                              ,(NULL,'B',NULL,NULL)
                                              ,(NULL,NULL,'C',NULL)
                                              ,(NULL,NULL,NULL,'D')


                                              SELECT
                                              NS.COL_01
                                              ,NS.COL_02
                                              ,NS.COL_03
                                              ,NS.COL_04,
                                              Stuff(
                                              Coalesce(', ' + nullif(NS.COL_01, ''), '')
                                              + Coalesce(', ' + nullif(NS.COL_02, ''), '')
                                              + Coalesce(', ' + nullif(NS.COL_03, ''), '')
                                              +Coalesce(', ' + nullif(NS.COL_04, ''), '')
                                              , 1, 1, '') AS CONC_COLS
                                              FROM @NULL_SAMLES NS





                                              share|improve this answer




























                                                0












                                                0








                                                0







                                                I have this work around with example. Hope this helps. Just go to SQL server, select new query and CP following query:



                                                DECLARE @NULL_SAMLES TABLE
                                                (
                                                NS_ID INT IDENTITY(1,1) PRIMARY KEY CLUSTERED NOT NULL
                                                ,COL_01 VARCHAR(10) NULL
                                                ,COL_02 VARCHAR(10) NULL
                                                ,COL_03 VARCHAR(10) NULL
                                                ,COL_04 VARCHAR(10) NULL
                                                )

                                                INSERT INTO @NULL_SAMLES(COL_01,COL_02,COL_03,COL_04)
                                                VALUES
                                                ('A','B','C','D')
                                                ,(' ' ,'B','C','D')
                                                ,(' ',NULL,'C','D')
                                                ,('A','B',NULL,'D')
                                                ,('A','B','C',NULL)
                                                ,(NULL,'B',NULL,'D')
                                                ,(NULL,'B','C',NULL)
                                                ,('A',NULL,'C',NULL)
                                                ,('A',NULL,NULL,'D')
                                                ,('A',NULL,NULL,NULL)
                                                ,(NULL,'B',NULL,NULL)
                                                ,(NULL,NULL,'C',NULL)
                                                ,(NULL,NULL,NULL,'D')


                                                SELECT
                                                NS.COL_01
                                                ,NS.COL_02
                                                ,NS.COL_03
                                                ,NS.COL_04,
                                                Stuff(
                                                Coalesce(', ' + nullif(NS.COL_01, ''), '')
                                                + Coalesce(', ' + nullif(NS.COL_02, ''), '')
                                                + Coalesce(', ' + nullif(NS.COL_03, ''), '')
                                                +Coalesce(', ' + nullif(NS.COL_04, ''), '')
                                                , 1, 1, '') AS CONC_COLS
                                                FROM @NULL_SAMLES NS





                                                share|improve this answer















                                                I have this work around with example. Hope this helps. Just go to SQL server, select new query and CP following query:



                                                DECLARE @NULL_SAMLES TABLE
                                                (
                                                NS_ID INT IDENTITY(1,1) PRIMARY KEY CLUSTERED NOT NULL
                                                ,COL_01 VARCHAR(10) NULL
                                                ,COL_02 VARCHAR(10) NULL
                                                ,COL_03 VARCHAR(10) NULL
                                                ,COL_04 VARCHAR(10) NULL
                                                )

                                                INSERT INTO @NULL_SAMLES(COL_01,COL_02,COL_03,COL_04)
                                                VALUES
                                                ('A','B','C','D')
                                                ,(' ' ,'B','C','D')
                                                ,(' ',NULL,'C','D')
                                                ,('A','B',NULL,'D')
                                                ,('A','B','C',NULL)
                                                ,(NULL,'B',NULL,'D')
                                                ,(NULL,'B','C',NULL)
                                                ,('A',NULL,'C',NULL)
                                                ,('A',NULL,NULL,'D')
                                                ,('A',NULL,NULL,NULL)
                                                ,(NULL,'B',NULL,NULL)
                                                ,(NULL,NULL,'C',NULL)
                                                ,(NULL,NULL,NULL,'D')


                                                SELECT
                                                NS.COL_01
                                                ,NS.COL_02
                                                ,NS.COL_03
                                                ,NS.COL_04,
                                                Stuff(
                                                Coalesce(', ' + nullif(NS.COL_01, ''), '')
                                                + Coalesce(', ' + nullif(NS.COL_02, ''), '')
                                                + Coalesce(', ' + nullif(NS.COL_03, ''), '')
                                                +Coalesce(', ' + nullif(NS.COL_04, ''), '')
                                                , 1, 1, '') AS CONC_COLS
                                                FROM @NULL_SAMLES NS






                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Aug 14 '18 at 10:58









                                                anothernode

                                                2,681102542




                                                2,681102542










                                                answered Aug 14 '18 at 10:25









                                                Chetan BirajdarChetan Birajdar

                                                277




                                                277























                                                    0














                                                    Don't underestimate the simple power of the CASE statement, which can be concatenated. Here's a self-contained example you can run as-is:



                                                    SELECT
                                                    CASE WHEN x.FIRST_NAME IS NULL THEN x.FIRST_NAME ELSE x.FIRST_NAME || ' ' END ||
                                                    CASE WHEN x.MIDDLE_NAME IS NULL THEN x.MIDDLE_NAME ELSE x.MIDDLE_NAME || ' ' END ||
                                                    x.LAST_NAME
                                                    FROM (SELECT 'John' AS FIRST_NAME, NULL AS MIDDLE_NAME, 'Doe' AS LAST_NAME FROM DUAL) x;





                                                    share|improve this answer




























                                                      0














                                                      Don't underestimate the simple power of the CASE statement, which can be concatenated. Here's a self-contained example you can run as-is:



                                                      SELECT
                                                      CASE WHEN x.FIRST_NAME IS NULL THEN x.FIRST_NAME ELSE x.FIRST_NAME || ' ' END ||
                                                      CASE WHEN x.MIDDLE_NAME IS NULL THEN x.MIDDLE_NAME ELSE x.MIDDLE_NAME || ' ' END ||
                                                      x.LAST_NAME
                                                      FROM (SELECT 'John' AS FIRST_NAME, NULL AS MIDDLE_NAME, 'Doe' AS LAST_NAME FROM DUAL) x;





                                                      share|improve this answer


























                                                        0












                                                        0








                                                        0







                                                        Don't underestimate the simple power of the CASE statement, which can be concatenated. Here's a self-contained example you can run as-is:



                                                        SELECT
                                                        CASE WHEN x.FIRST_NAME IS NULL THEN x.FIRST_NAME ELSE x.FIRST_NAME || ' ' END ||
                                                        CASE WHEN x.MIDDLE_NAME IS NULL THEN x.MIDDLE_NAME ELSE x.MIDDLE_NAME || ' ' END ||
                                                        x.LAST_NAME
                                                        FROM (SELECT 'John' AS FIRST_NAME, NULL AS MIDDLE_NAME, 'Doe' AS LAST_NAME FROM DUAL) x;





                                                        share|improve this answer













                                                        Don't underestimate the simple power of the CASE statement, which can be concatenated. Here's a self-contained example you can run as-is:



                                                        SELECT
                                                        CASE WHEN x.FIRST_NAME IS NULL THEN x.FIRST_NAME ELSE x.FIRST_NAME || ' ' END ||
                                                        CASE WHEN x.MIDDLE_NAME IS NULL THEN x.MIDDLE_NAME ELSE x.MIDDLE_NAME || ' ' END ||
                                                        x.LAST_NAME
                                                        FROM (SELECT 'John' AS FIRST_NAME, NULL AS MIDDLE_NAME, 'Doe' AS LAST_NAME FROM DUAL) x;






                                                        share|improve this answer












                                                        share|improve this answer



                                                        share|improve this answer










                                                        answered Nov 15 '18 at 20:32









                                                        Gustavo LopezGustavo Lopez

                                                        11




                                                        11






























                                                            draft saved

                                                            draft discarded




















































                                                            Thanks for contributing an answer to Stack Overflow!


                                                            • Please be sure to answer the question. Provide details and share your research!

                                                            But avoid



                                                            • Asking for help, clarification, or responding to other answers.

                                                            • Making statements based on opinion; back them up with references or personal experience.


                                                            To learn more, see our tips on writing great answers.




                                                            draft saved


                                                            draft discarded














                                                            StackExchange.ready(
                                                            function () {
                                                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f11956844%2fspaces-when-concatenating-multiple-columns-and-one-column-is-null-oracle%23new-answer', 'question_page');
                                                            }
                                                            );

                                                            Post as a guest















                                                            Required, but never shown





















































                                                            Required, but never shown














                                                            Required, but never shown












                                                            Required, but never shown







                                                            Required, but never shown

































                                                            Required, but never shown














                                                            Required, but never shown












                                                            Required, but never shown







                                                            Required, but never shown







                                                            Popular posts from this blog

                                                            How to pass form data using jquery Ajax to insert data in database?

                                                            National Museum of Racing and Hall of Fame

                                                            Guess what letter conforming each word