views:

988

answers:

2

Hi all, I found in this article, that since ORACLE 10g, there is a way to make a particular connection-session compare strings case-insensitive, without needing any crazy SQL functions, using an ALTER SESSION.

Does anyone know if, in 11g, there might be a way to make the database to always operate in this mode by default for all new connection-sessions, thereby eliminating the need for running ALTER SESSIONs every time you connect?

Or perhaps, an additional parameter you could specify on your connection string that would turn the same on?

+2  A: 

You could just set the NLS_SORT, NLS_COMP parameters mentioned in the article as the values in the the Oracle init file using the alter system set <parameter> = <value>; clause.

Info on using the alter system commands can be found here.

Here is a good link on the correct usage of the NLS_* parameters. Note that some settings of of the NLS_SORT parameter can/could cause performance issues, namely when it is not set to BINARY. The Oracle docs state:

Setting NLS_SORT to anything other than BINARY causes a sort to use a full table scan, regardless of the path chosen by the optimizer. BINARY is the exception because indexes are built according to a binary order of keys. Thus the optimizer can use an index to satisfy the ORDER BY clause when NLS_SORT is set to BINARY. If NLS_SORT is set to any linguistic sort, the optimizer must include a full table scan and a full sort in the execution plan.

RC
While that quote is from the oracle documentation, it also makes no sense "regardless of the path chosen by the optimizer". A more useful reference for this ishttp://download.oracle.com/docs/cd/B19306_01/server.102/b14225/ch5lingsort.htm#sthref650
Gary
The "good link on the correct usage of the NLS_* parameters" I provided in my answer is the same link and information you provided except that the link in my answer is from the 11g documentation.
RC
+1  A: 

Sure you can!

Get ur friendly DBA to set these paramaters:

ALTER SYSTEM SET NLS_COMP=LINGUISTIC SCOPE SPFILE;

ALTER SYSTEM SET NLS_SORT=BINARY_AI SCOPE SPFILE;

This is taken from my short article on How to make Oracle Case Insensitive

geekzspot
What about the quote-out in RC's answer. Will doing this utterly destroy the performance of the system, as that would seem to indicate?
eidylon