Q
Problem solve Get help with specific problems with your technologies, process and projects.

Concatenating a string to a number

I have some numbers which are not uniform in size. Now if I have to put '.TIF' at the end of each number, which command can I use? For example, 123, 4567, 78901. This I want to update as 123.TIF, 4567.TIF...

All you need to do here is CAST the number as a VARCHAR datatype and then do the concatenation --

select cast(yournumber as varchar(8)) || '.TIF'
  from yourtable

When the number is converted to VARCHAR, it becomes a string that is just long enough to hold the digits of the number. Use a varchar length that is big enough to hold the largest number.

For More Information


Dig Deeper on Oracle and SQL

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close