Unix Technical Forum

nls_sort=binary_ci

This is a discussion on nls_sort=binary_ci within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hi, I am having issues with nls_sort=binary_ci, nls_sort setting is not sorting rows in case insensitive Oracle 10g R2 ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 11:53 AM
janu
 
Posts: n/a
Default nls_sort=binary_ci

Hi,

I am having issues with nls_sort=binary_ci, nls_sort setting is not
sorting rows in case insensitive

Oracle 10g R2
Linux x86

steps I followed

alter system set nls_sort=binary_ci scope=spfile;
create pfile from spfile;
shutdown immediate;
startup open;

Here is the sample data after the setting

ACTION_ID ACTION_NAME PD_ID PD_NAME

166 Admin::AdminEditRole 773 SPrivileges
166 Admin::AdminEditRole 774 SPrivileges
166 Admin::AdminEditRole 775 sNewRoleName
166 Admin::AdminEditRole 775 sOriginalRoleName


I WANT THE DATA TO BE SORTED LIKE THIS

ACTION_ID ACTION_NAME PD_ID PD_NAME

166 Admin::AdminEditRole 775 sNewRoleName
166 Admin::AdminEditRole 775 sOriginalRoleName
166 Admin::AdminEditRole 774 SPrivileges
166 Admin::AdminEditRole 773 SPrivileges



Thank you in advance
RA

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 11:53 AM
DA Morgan
 
Posts: n/a
Default Re: nls_sort=binary_ci

janu wrote:
> Hi,
>
> I am having issues with nls_sort=binary_ci, nls_sort setting is not
> sorting rows in case insensitive
>
> Oracle 10g R2
> Linux x86
>
> steps I followed
>
> alter system set nls_sort=binary_ci scope=spfile;
> create pfile from spfile;
> shutdown immediate;
> startup open;
>
> Here is the sample data after the setting
>
> ACTION_ID ACTION_NAME PD_ID PD_NAME
>
> 166 Admin::AdminEditRole 773 SPrivileges
> 166 Admin::AdminEditRole 774 SPrivileges
> 166 Admin::AdminEditRole 775 sNewRoleName
> 166 Admin::AdminEditRole 775 sOriginalRoleName
>
>
> I WANT THE DATA TO BE SORTED LIKE THIS
>
> ACTION_ID ACTION_NAME PD_ID PD_NAME
>
> 166 Admin::AdminEditRole 775 sNewRoleName
> 166 Admin::AdminEditRole 775 sOriginalRoleName
> 166 Admin::AdminEditRole 774 SPrivileges
> 166 Admin::AdminEditRole 773 SPrivileges
>
>
>
> Thank you in advance
> RA


Changing an NLS_SORT parameter does not sort the data in a table.
Oracle's default tables are heap tables. Nothing is sorted.
What is the SQL statement you are issuing to retrieve the data?
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 11:55 AM
janu
 
Posts: n/a
Default Re: nls_sort=binary_ci

Here is the query

SELECT ACTION_ID
, ACTION_NAME
,pd_id
, PD_NAME
, PT_NAME
, PD_GLOBAL_JOIN.GP_VALUE
, PD_GLOBAL_JOIN.GP_NAME
, AV_VALUE
, AV_GLOBAL_JOIN.GP_VALUE AV_GLOBAL_JOIN_GP_VALUE
, AV_GLOBAL_JOIN.GP_NAME AV_GLOBAL_JOIN_GP_NAME
, AV_GLOBAL_JOIN.GP_DESCRIPTION AV_GLOBAL_JOIN_GP_DESCRIPTION
, AV_GLOBAL_JOIN.GP_PROJECTID AV_GLOBAL_JOIN_GP_PROJECTID
, AV_GLOBALPARAMETERID
FROM VMTP_ACTION
LEFT JOIN VMTP_PARAMETERDEFINITION ON
(ACTION_ID = PD_ACTIONID
AND PD_METASTATUS = 1)
LEFT JOIN VMTP_ACCEPTEDVALUE ON
(PD_ID = AV_PARAMETERDEFINITIONID)
LEFT JOIN VMTP_GLOBALPARAMETER AV_GLOBAL_JOIN ON
(AV_GLOBALPARAMETERID = AV_GLOBAL_JOIN.GP_ID)
LEFT JOIN VMTP_PARAMETERTYPE ON
(PD_PARAMETERTYPEID = PT_ID)
LEFT JOIN VMTP_GLOBALPARAMETER PD_GLOBAL_JOIN ON
(PD_DEFAULT_GLOBALPARAMETERID = PD_GLOBAL_JOIN.GP_ID)
WHERE ACTION_ID IN (166)
order by pd_name;

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 11:55 AM
DA Morgan
 
Posts: n/a
Default Re: nls_sort=binary_ci

janu wrote:
> Here is the query
>
> SELECT ACTION_ID
> , ACTION_NAME
> ,pd_id
> , PD_NAME
> , PT_NAME
> , PD_GLOBAL_JOIN.GP_VALUE
> , PD_GLOBAL_JOIN.GP_NAME
> , AV_VALUE
> , AV_GLOBAL_JOIN.GP_VALUE AV_GLOBAL_JOIN_GP_VALUE
> , AV_GLOBAL_JOIN.GP_NAME AV_GLOBAL_JOIN_GP_NAME
> , AV_GLOBAL_JOIN.GP_DESCRIPTION AV_GLOBAL_JOIN_GP_DESCRIPTION
> , AV_GLOBAL_JOIN.GP_PROJECTID AV_GLOBAL_JOIN_GP_PROJECTID
> , AV_GLOBALPARAMETERID
> FROM VMTP_ACTION
> LEFT JOIN VMTP_PARAMETERDEFINITION ON
> (ACTION_ID = PD_ACTIONID
> AND PD_METASTATUS = 1)
> LEFT JOIN VMTP_ACCEPTEDVALUE ON
> (PD_ID = AV_PARAMETERDEFINITIONID)
> LEFT JOIN VMTP_GLOBALPARAMETER AV_GLOBAL_JOIN ON
> (AV_GLOBALPARAMETERID = AV_GLOBAL_JOIN.GP_ID)
> LEFT JOIN VMTP_PARAMETERTYPE ON
> (PD_PARAMETERTYPEID = PT_ID)
> LEFT JOIN VMTP_GLOBALPARAMETER PD_GLOBAL_JOIN ON
> (PD_DEFAULT_GLOBALPARAMETERID = PD_GLOBAL_JOIN.GP_ID)
> WHERE ACTION_ID IN (166)
> order by pd_name;
>


Consider a syntax related to this:

SELECT * FROM test
ORDER BY NLSSORT(name, 'NLS_SORT = BINARY_CI');
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 11:55 AM
janu
 
Posts: n/a
Default Re: nls_sort=binary_ci

Thanks Morgan, I made the change as you recommanded.

I have one more question.

If I do a select on database_properties and v$parameter, I see a
difference. Could you please explain what might be?

select * from database_properties where property_name like '%SORT%'

NLS_SORT BINARY Linguistic definition

select name, value from v$parameter where name like '%sort%'

nls_sort BINARY_CI

Thank you
RA

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-08-2008, 11:55 AM
Laurenz Albe
 
Posts: n/a
Default Re: nls_sort=binary_ci

janu <angani@gmail.com> wrote:
> If I do a select on database_properties and v$parameter, I see a
> difference. Could you please explain what might be?
>
> select * from database_properties where property_name like '%SORT%'
>
> NLS_SORT BINARY Linguistic definition
>
> select name, value from v$parameter where name like '%sort%'
>
> nls_sort BINARY_CI


http://download-uk.oracle.com/docs/c...ta.htm#i637232

Yours,
Laurenz Albe
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-08-2008, 11:55 AM
janu
 
Posts: n/a
Default Re: nls_sort=binary_ci

Hi Laurenz A,

I set my system setting to BINARY_CI

sql>alter system set nls_sort=binary_ci scope=both;

My question is ,why there is difference between database_properties and
V$parameter.

Thank you
RA

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-08-2008, 11:56 AM
Laurenz Albe
 
Posts: n/a
Default Re: nls_sort=binary_ci

janu <angani@gmail.com> wrote:
> I set my system setting to BINARY_CI
>
> sql>alter system set nls_sort=binary_ci scope=both;
>
> My question is ,why there is difference between database_properties and
> V$parameter.


Sorry for my previous reply, I did not understand what your problem was.

It is indeed strange that the view DATABASE_PROPERTIES and its
underlying table SYS.PROPS$ does not reflect the change of NLS_SORT.

Maybe it is a bug in Oracle.
You should open a service request if you want to find out.

By the way, the command you give to change the database parameter
NLS_SORT is not correct. I get the error:

ORA-02096: specified initialization parameter is not modifiable with this
option

You can only modify it in the spfile.

Yours,
Laurenz Albe
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-08-2008, 11:56 AM
joel garry
 
Posts: n/a
Default Re: nls_sort=binary_ci


janu wrote:
> Hi Laurenz A,
>
> I set my system setting to BINARY_CI
>
> sql>alter system set nls_sort=binary_ci scope=both;
>
> My question is ,why there is difference between database_properties and
> V$parameter.
>
> Thank you
> RA


I'm guessing what you are seeing is the difference between how Oracle
sorts (binary) and whether it uses case insensitivity (binary_ci).
This varies based on which sql verbs you are using (see metalink
Note:263083.1). Since nls_sort is the collating sequence used, Oracle
must somehow keep track of all the derivations of it. Perhaps the bug
is both views should have both attributes. What happens when you set
your language to, say, CATALAN?

This certainly could be documented better, perhaps an SR is in order,
we shouldn't have to guess.

jg
--
@home.com is bogus.
http://www.engadget.com/2006/12/12/l...igner-glasses/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:28 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com