Clarity

 View Only
  • 1.  How to search for em dash using query.

    Posted Feb 13, 2018 07:07 AM

    Hi ,

     

    While copy pasting, some of the Resource OBS units were created having Em Dash.

     

    So we need to identify such Resource OBS units having Em Dash( double hyphen) with query, but not able to know how to use it in the query.

     

    Using the below query I can get the Resource OBS units , but dont know how to match the Unit name.

     

    select * from (
    SELECT
    POU.UNIQUE_NAME UNIT_ID
    ,Pou.Id id
    ,POU.NAME
    ,pou.type_id type_id
    FROM
    Prj_Obs_Units POU
    where pou.type_id in (select id from PRJ_OBS_TYPES where unique_name='resource')
    )A

    -- where A.name like '%<Condition>%'

     

    How to frame the <condition>  so that I can search with double dash ?

     

    I have tried '%--%' , but doesn't give me result.

     

    Thanks.



  • 2.  Re: How to search for em dash using query.

    Posted Feb 13, 2018 10:38 AM

    It must  be something else.

    Do you get results when you leave out

    where A.name like '%<Condition>%' ?

    Is it Oracle or MS SQL

     

    When I run (with Oracle as the db)

    SELECT PRID
          ,PRNAME
      FROM prtask
    Where prname like '%--%'

    I get



  • 3.  Re: How to search for em dash using query.

    Posted Feb 13, 2018 11:03 AM

    I have copied the Em-Dash from browser and pasted in the where condition and I was able to get records.

     

    Both RegExp and like fetched same number of records.

     

    The -- doesn't work , because its not the Em-Dash , because u can see the gap between the 2 adjacent hypens, where as Em-Dash appears as a long Hypen, so I have copied from browser.

     

    where

    --and REGEXP_LIKE (OBS.name,'–');
    --and obs.name like '%–%';



  • 4.  Re: How to search for em dash using query.

    Posted Feb 13, 2018 11:50 AM

    OK, so when you match the character exactly the query works as desired.



  • 5.  Re: How to search for em dash using query.

    Posted Feb 14, 2018 03:00 AM

    Yes Its working, Please check from your side to double confirm.



  • 6.  Re: How to search for em dash using query.

    Posted Feb 14, 2018 07:09 AM

    No problem. SQL usually work reliably and predictably.

    Copying the em dash to the where clause

    SELECT PRID
          ,PRNAME
      FROM prtask
    Where (prname like '%--%'
    or
    prname like '%–%')

     

    gives