Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Concatenate strings in Oracle SQL without a space in between?

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?

like image 896
brainless Avatar asked Oct 30 '11 13:10

brainless


Video Answer


1 Answers

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.

like image 146
Erwin Brandstetter Avatar answered Oct 18 '22 09:10

Erwin Brandstetter