8

I am trying to take a column that stores a id # for a webpage on a site and store it with the full url.

If the Article ID is 5. I want it to store return something like this

<a href="http://website.com/5">5</a>

What I am trying to do is combine a string put in the search and a number to make a URL for the column. I know this syntax is incorrect but I can not find anyway on how to do it.

SELECT
CASE                                                                        
WHEN m_tableFoo.articleId = '0' THEN                                
    'Not Applicable'                                                    
ELSE '<a href="http://website.com/'+m_tableFoo.articleId+'/">'+m_tableFoo.articleId+'</a>' 
END AS articleID
from m_tableFoo

I have tried searching the web and Stack Overflow, but I am not sure if my search wording is incorrect or my description.

3
  • Take a look at: stackoverflow.com/questions/278189/… Commented Jan 21, 2013 at 16:44
  • 1
    You will need to convert the articleID to a string, and also the concatenation operator in Oracle is || Commented Jan 21, 2013 at 16:45
  • thanks I'll take a look at that, that seems to be the correct wording. Commented Jan 21, 2013 at 16:46

1 Answer 1

19

oracle uses || for concatenation, not +. You will probably also need to TO_CHAR the article ids

Sign up to request clarification or add additional context in comments.

1 Comment

Just to complete this statement: || is the SQL standard for string concatenation and besides MySQL and Microsoft all DBMS vendor comply with that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.