Created
January 13, 2015 17:17
-
-
Save AndrewLane/c5738570a0acd708edd4 to your computer and use it in GitHub Desktop.
Oracle 11g vs Oracle 12c NLS_SORT issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Data before 'alter session'... | |
---------- | |
BulkEdit_Completed | |
BulkEdit_Delete Recurring Daily Queued | |
BulkEdit_Delete Recurring Daily Queued - Daily | |
BulkEdit_Delete Recurring Daily Queued - Daily | |
Job 1 | |
Job 2 | |
Job 3 | |
Nov._4th_2014 | |
Testing | |
Testing | |
Testing | |
samplebulk | |
testing | |
unique | |
Data after 'alter session'... | |
---------- | |
BulkEdit_Completed | |
BulkEdit_Delete Recurring Daily Queued | |
BulkEdit_Delete Recurring Daily Queued - Daily | |
BulkEdit_Delete Recurring Daily Queued - Daily | |
Job 1 | |
Job 2 | |
Job 3 | |
Nov._4th_2014 | |
samplebulk | |
Testing | |
Testing | |
Testing | |
testing | |
unique |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Data before 'alter session'... | |
---------- | |
AA_Testing R36 | |
AA_Testing R36 | |
AA_Testing R36 | |
AA_Testing R36 | |
Bulk Edit Numeric Freeform | |
Bulk Edit-ve | |
Bulk Edit_All Contacts | |
Bulk Edit_Copy_Edited | |
Bulk Edit_Copy_Edited_copy | |
Bulk Edit_Date | |
Bulk Edit_Numeric Name Value | |
Bulk Edit_Numeric Negative Positive | |
Bulk Edit_ScheduleNoneToRunNow | |
Bulk Edit_ScheduleRecurringDailyEndAfter | |
Bulk Edit_ScheduleRecurringDailyEndOn | |
Bulk Edit_ScheduleRecurringMonthlyEndAfter | |
Bulk Edit_ScheduleRecurringMonthlyEndOn | |
Bulk Edit_ScheduleRecurringWeeklyEndAfter | |
Bulk Edit_ScheduleRecurringWeeklyEndOn | |
Bulk Edit_ScheduleRecurringWeeklyEndOn | |
Bulk Edit_ScheduleRecurringWeeklyEndOn | |
Bulk Edit_ScheduleRecurringYearlyEndAfter | |
Bulk Edit_ScheduleRecurringYearlyEndOn | |
Bulk Edit_ScheduleRunOn | |
Bulk Edit_Text Freeform | |
Bulk Edit_Text Multi Select | |
Bulk Edit_Text Negative Positive | |
BulkEdit_Completed | |
BulkEdit_Delete Recurring Daily Queued | |
BulkEdit_Delete Recurring Daily Queued - Daily | |
BulkEdit_Delete Recurring Daily Queued - Daily | |
BulkEdit_Manage&Logs | |
BulkEdit_Num | |
BulkEdit_Team1 | |
BulkEdit_Team2 | |
BulkEdit_Text_Name | |
BulkEdit_Text_NameValues | |
BulkEdit_Va | |
BulkEdit_Validations | |
ContactEdits_MultipleConditions | |
ContactStages_UpdateContact | |
EMTNG-19024 | |
EMTNG-19024 | |
Job 1 | |
Job 2 | |
Job 3 | |
PST Bulk Edit | |
PST Bulk Edit | |
PST Testing | |
Sample | |
Sample12 | |
Sample12 | |
Sample12 | |
Sample5 | |
Sample5 | |
Sample5 | |
Testing | |
Testing | |
Testing | |
Testing - One time | |
Testing23 | |
cctest | |
sample1 | |
sample1 | |
testt | |
Data after 'alter session'... | |
---------- | |
AA_Testing R36 | |
AA_Testing R36 | |
AA_Testing R36 | |
AA_Testing R36 | |
Bulk Edit Numeric Freeform | |
Bulk Edit-ve | |
Bulk Edit_All Contacts | |
Bulk Edit_Copy_Edited | |
Bulk Edit_Copy_Edited_copy | |
Bulk Edit_Date | |
Bulk Edit_Numeric Name Value | |
Bulk Edit_Numeric Negative Positive | |
Bulk Edit_ScheduleNoneToRunNow | |
Bulk Edit_ScheduleRecurringDailyEndAfter | |
Bulk Edit_ScheduleRecurringDailyEndOn | |
Bulk Edit_ScheduleRecurringMonthlyEndAfter | |
Bulk Edit_ScheduleRecurringMonthlyEndOn | |
Bulk Edit_ScheduleRecurringWeeklyEndAfter | |
Bulk Edit_ScheduleRecurringWeeklyEndOn | |
Bulk Edit_ScheduleRecurringWeeklyEndOn | |
Bulk Edit_ScheduleRecurringWeeklyEndOn | |
Bulk Edit_ScheduleRecurringYearlyEndAfter | |
Bulk Edit_ScheduleRecurringYearlyEndOn | |
Bulk Edit_ScheduleRunOn | |
Bulk Edit_Text Freeform | |
Bulk Edit_Text Multi Select | |
Bulk Edit_Text Negative Positive | |
BulkEdit_Completed | |
BulkEdit_Delete Recurring Daily Queued | |
BulkEdit_Delete Recurring Daily Queued - Daily | |
BulkEdit_Delete Recurring Daily Queued - Daily | |
BulkEdit_Manage&Logs | |
BulkEdit_Num | |
BulkEdit_Team1 | |
BulkEdit_Team2 | |
BulkEdit_Text_Name | |
BulkEdit_Text_NameValues | |
BulkEdit_Va | |
BulkEdit_Validations | |
ContactEdits_MultipleConditions | |
ContactStages_UpdateContact | |
EMTNG-19024 | |
EMTNG-19024 | |
Job 1 | |
Job 2 | |
Job 3 | |
PST Bulk Edit | |
PST Bulk Edit | |
PST Testing | |
Sample | |
Sample12 | |
Sample12 | |
Sample12 | |
Sample5 | |
Sample5 | |
Sample5 | |
Testing | |
Testing | |
Testing | |
Testing - One time | |
Testing23 | |
cctest | |
sample1 | |
sample1 | |
testt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Configuration; | |
using Oracle.ManagedDataAccess.Client; | |
namespace SortDiagnostic | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string connectionString = ConfigurationManager.AppSettings["connStr"]; | |
using (var conn = new OracleConnection {ConnectionString = connectionString}) | |
{ | |
conn.Open(); | |
using (var cmd = conn.CreateCommand()) | |
{ | |
Console.WriteLine("Data before 'alter session'..."); | |
Console.WriteLine("----------"); | |
SpitOutData(cmd); | |
//try to get the sorting to be accent insensitive | |
cmd.CommandText = "ALTER SESSION SET NLS_SORT=BINARY_AI"; | |
cmd.ExecuteNonQuery(); | |
Console.WriteLine(); | |
Console.WriteLine(); | |
Console.WriteLine("Data after 'alter session'..."); | |
Console.WriteLine("----------"); | |
SpitOutData(cmd); | |
} | |
} | |
} | |
static void SpitOutData(OracleCommand cmd) | |
{ | |
cmd.CommandText = @"SELECT NAME FROM (SELECT ROW_NUMBER() OVER (order by NAME ASC) | |
peta_rn, emtcontacteditactivities.* from emtcontacteditactivities) peta_paged WHERE peta_rn>0 AND peta_rn<=100"; | |
using (var reader = cmd.ExecuteReader()) | |
{ | |
while (reader.Read()) | |
{ | |
Console.WriteLine(reader.GetString(0)); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment