|
-
Jul 29th, 2007, 11:41 AM
#1
Thread Starter
Registered User
[RESOLVED] [Oracle 10g XE] Case Insensitive field
Hi all,
I'm playing around with the sample database in Oracle 10g XE. I'm trying to select records based upon the text DEPARTMENT_NAME field in a case insensitive manner. For example, if I search for "admininstration" I would like it to match the "Administration" department.
I have this working in this fashion, but just wondering if there is some built-in property in the command or if this is it? Thanks.
Code:
Dim SQLString As String = _
"SELECT * " & _
"FROM departments " & _
"WHERE UPPER(department_name) = :deptName"
Dim cmd As New OracleCommand(SQLString, conn)
cmd.Parameters.Add(New OracleParameter("deptName", (Me.TextBox2.Text).ToUpper()))
Last edited by nmadd; Jul 29th, 2007 at 11:51 AM.
-
Jul 30th, 2007, 07:03 AM
#2
Re: [Oracle 10g XE] Case Insensitive field
Oracle searchs for text are always case sensitive. (Maybe a hold over from Unix liniage). When I was doing Oracle every day we stored all text data (in one word fields like department) into Uppercase (Upper()). Then always cast the query search value to UPPER() also. You can do it on the fly as you did but Oracle will not use any indexes when you do that. If there are is a lot of data in the table and a full table scan results it can cuase a slow down to the view of the user.
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Jul 30th, 2007, 07:49 AM
#3
Thread Starter
Registered User
Re: [Oracle 10g XE] Case Insensitive field
Thanks for the info Gary.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|