Start a new topic

regexp_like and other regexp comparisons don't act logically for character ranges at first sight

Hej


I have the following situation. I was not expecting the following select to return those four records as TASK contains uppercase characters.

 

select case lower(PERIODE)
          when 'basis' then 'M'
          when 'mnq' then 'Q'
          else coalesce(PERIODE, 'M')
       end as PERIODE
      ,TASK       
      ,DESCRIPTION
      ,THEMA
  from OWN_TEMP.KELT_EOP_TASKS
where 1 = 1
   and regexp_like(TASK
                  ,'^[a-z_]+$'
                  ,'c')
   and 1 = 1;

 


It turned out that my session was running NLS_SORT with the value GERMAN, which makes the character sequences not being disjoint, A is next to a, B to b etc.(AaBbCc…) instead of abcd…ABCDE….


alter session set NLS_SORT = 'BINARY';

 clears the problem. So I introduced the environment variable NLS_SORT (analogously to NLS_LANG) but unfortunately it does not get respected by DbVis.


How can I fix that such I do not need to run above command with every connection to our Oracle databases? I have not the possibility to alter the OS settings and installations on my customers site.


Ha det bra


Thiemo


Thiemo,


I suggest that you add a Connection Hook. Either for each individual database connection or for all database connections of a certain type, e.g. Oracle. 


Do this either in the Connection Properties for a connection or for a database type in Tools->Tool Properties under the Database / Oracle category.


Read more in:

https://www.dbvis.com/docs/ug/database-connection-options/executing-sql-at-connect-and-disconnect/


Regards


Roger


1 person likes this

Tusend tack :-)

Login or Signup to post a comment