database - How to sort results case-insensitive in Oracle SQL? -
The classic way to query a SQL database case - is inadvertently Java:
String name = ...; // Get user input (case is unknown) string sql = "choose from person * where less (name) =?"; Object jdbcBindVariable = name.toLowerCase (); // Using JDBC, bind that variable and run the SQL query
The problem is that the low-cover is local-specific operation. For example, in the above code, there are two lower-cover procedures: >>
- For example, the letter "+
I
" returns a different result in lower-case English and Turkish: String # toLowerCase () method - The following () database function
How can I ensure that Java and the database are using the same location and thus Are a valid comparison?
I know that string class has lowercase (locale) method, but how do I know which database the database is using? Can I see it programmatically, or do I need to move the hard-code to the place with which I think the database (Oracle 10G in this case) is configured?
Simple answer does this to the database. In this way, the binary variable is inserted in lower case, in the same way the value of the column is placed in lowercase.
string sql = "select from person * where less (name) = less" (?);
Comments
Post a Comment