Concat- this useful function is often overlooked in BI. However, by using it – you can make your routine work much easier (at both BMM and Presentation layers of OBIEE).
There are two ways of using this function in OBIEE. The first method is to simply concatenate two character strings. The second method uses the character string concatenation character (||) to concatenate more than two character strings. You can also reuse the CONCAT function in OBIEE, but this might be an “excessive use of force”. Please note, you can only concatenate CHAR/VACHAR strings *you can use CAST function to convert from other data type*.
CONCAT (expression1, expression2)
character_expression Expressions that evaluate to character strings (if numeric you can use CAST function).
For example – CONCAT (‘The year is ‘, CAST(TimeTable.FiscalYear AS CHAR))
CONCAT (expression1 || expression2 || expression3 and so forth)
Very much like the previous one – expressions that evaluate to character strings, separated by the concatenation operator || (double vertical bars).
For example – CONCAT (‘Total is: $’ || SalesFact.TotalSales ||Â ‘USD’)
I was having trouble using the CONCAT function type 2 expression in the Business Layer of the Analytics Admin Tool (using multiple expressions which evaluate to strings). The problem seemed to happen with functions such as
CONCAT (“DimTable”.”Org”.”STATE” ||”DimTable”.”Org”.”CITY” ||”DimTable”.”Org”.”ADDRESS”) and the error message is:Â Â [nQSError: 27002] Near <)>: Syntax error [nQSError: 26012] .
The workaround seems to be using a nested CONCAT statement – CONCAT (CONCAT(“DimTable”.”Org”.”STATE” ,”DimTable”.”Org”.”CITY”),”DimTable”.”Org”.”ADDRESS”) Hopefully, it’ll be fixed in the OBIEE release 11g