String Function in OBIEE - OBIEE GURU

govtjobonline-Latest Government Jobs 2023 Recruitment Notifications

Latest Govt Jobs Whatsapp Group Links-Telegram

For Latest Govt Jobs 2023 or for Freejobalerts or Join

Latest Government Jobs 2023

Wednesday 22 October 2014

String Function in OBIEE

                                             Today i have received of the client requirement  to separate the form One column and the data of clomun is like below. String functions are very easy to use in Oracle. However, some of them (String functions) in particular have little different story sometimes in OBIEE.
    Let’s discuss one such case here today:
    Have a look at below column. Let’s say we want to separate text which is appearing before ‘_’ (underscore) and the one which is appearing after.
    Column
    However, the part before and after “_” may have different length. So now, if I want to display only the part before or after “_” regardless of the length or the location of “_”, how would we do it?
    Unlike SQL, we cant use INSTR in OBIEE. However, we can use LOCATE function to achieve the same.
    Enter this text in New Column Formula:
    Locate(‘_’,”PresentationFolderName”.”ColumnName”)
    Locate
    The above tells the location of ‘_’. However, we also need to know the length of string in each case.
    Enter this text in New Column Formula:
    LENGTH(”PresentationFolderName”.”ColumnName”)
    Length
    Now, we are almost towards the end. Finally use the substring command with below syntax:
    SUBSTRING(column name FROM integer FOR integer)
    a)       Thus, for string before (on left) of ‘_’, we will extract characters from left till the location of ‘_’ comes. And thus, the formula:
    SUBSTRING(“PresentationFolderName “.”ColumnName” from 1 for Locate(‘_’,” PresentationFolderName “.” ColumnName “)-1)
    Left Part
    We are using -1 at the end because we want to exclude ‘_’ from our output.

    b)       Now for the right part of the string, use below formula
    SUBSTRING(“PresentationFolderName “.”ColumnName” from Locate(‘_’,” PresentationFolderName “.” ColumnName “)+1 for LENGTH(”PresentationFolderName”.”ColumnName”))
    Right Part
    Here:
    1. +1 is used to start from Right side of ‘_’
    2. LENGTH is NOT going to append any trailing spaces in the end.

    Whatsapp group

    Govt Jobs Whatsapp Group Links 2023

    Telegram group

    Govt Jobs Telegram Group

    Facebook group

    Govt Job Online Facebook Group

    Follow on Facebook group

    Govt Jobs Online Facebook Page

    Subscribe to Youtube Channel

    Govtjobsonline Youtube

    Join Latest Govt Jobs Telegram Group here

    Join Government Jobs Whatsapp Group here (State Wise)

    Join State Wise Sarkari Results Telegram here

    1. ITI Jobs Notifications
    2. ITI Apprenticeship Program
    3. Diploma Jobs Notifications
    4. Engineering Jobs Notifications
    5. UPSC Jobs Notifications
    6. Court Jobs Notifications
    7. Staff Nurse Jobs Notifications
    8. NHM Jobs Notifications
    9. Exam Syllabus and Pattern
    10. SSC Recruitment

    1 comment:


    1. Used the following to remove a comma from the address field, in this case there were commas between the address and unit number:

      concat(SUBSTRING("Address" from 1 for Locate(',',"Address")-1),SUBSTRING("Address" from Locate(',',"Address")+1))

      ReplyDelete

    Latest Govt Jobs Vacancy 2023