Results 1 to 3 of 3

Thread: [RESOLVED] [Oracle 10g XE] Case Insensitive field

  1. #1

    Thread Starter
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    Resolved [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.

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    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

  3. #3

    Thread Starter
    Registered User nmadd's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    1,676

    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
  •  



Click Here to Expand Forum to Full Width