Search code examples
sqloracle-sqldeveloperdata-modelingdata-warehouseobiee

How will you get 2,3, and 5 letter of first name and concat it with 2,3 letter of last name to make a new column named LETTERS OF NAME?


For example, you are given a requirement to create a column based on the following scenario: Get letters of FirstName Column (2,3,5) CONCAT with letters of LastName column (2,3) to create a new column "LETTERS OF NAME".

P.S solution could be in SQL. I am using OBIEE if you have drag n drop solution you are welcome.


Solution

  • As mentioned by Gordon, you can use SUBSTR()

    SELECT SUBSTR(FIRST_NAME,2,2)||SUBSTR(FIRST_NAME,5,1)||SUBSTR(LAST_NAME,2,2) AS LETTERS_OF_NAME 
    FROM YOUR_TABLE;