Concatenate strings in Oracle SQL without a space in between?

13,102

This is not an issue with the concatenation operator but with the function to_char(). Try instead:

to_char(10000,'FM99999')

I quote the manual here:

FM .. Returns a value with no leading or trailing blanks.

Share:
13,102
brainless
Author by

brainless

Once I was: WebMethods, Java developer, Middleware Engineer Then: PHP Developer, Laravel, Application Design and Architecture Today:Android Developer Tomorrow : May be mainframe! or start a restaurant!! SOreadytohelp

Updated on July 29, 2022

Comments

  • brainless
    brainless almost 2 years

    I am trying to concatenate strings in oracle.

    The following is my query:

    insert into dummy values('c'||to_char(10000,'99999'));
    

    The expected result is:

    c10000
    

    But the output I get is with a space in between 'c' and the value 10000:

    c 10000 
    

    How to concat without spaces?