[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

Oracle SQL query - Concatenate text to specific field value issue

Hi

I would like to know how i can add text to my field result when i'm runing an SQL.

Ex:
Select Case
when ID = '1' then ('TEST_' + ID)
when ID = '2' then ('NO_TEST_' + ID)
end from location;

Open in new window


So if my ID = 1 then i want to add the text "TEST_" just before the value 1.

How can i do this?

Thanks again
0
Wilder1626
Asked:
Wilder1626
1 Solution
 
Haris DjulicCommented:
Here is the code:

Select Case
when ID = '1' then ('TEST_' || value)
when ID = '2' then ('NO_TEST_' || value)
else value
end from location;

Open in new window


You can test it here http://sqlfiddle.com/#!4/d6b56/4
0
 
Wilder1626Author Commented:
Thanks for your help.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now