473,382 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Case Insensitive Oracle Query

Hiya,

I am querying an Oracle database that I have no direct access to so cannot change server properties.
I need to do a case insensitive search on a name/or other variable (C# code)
i.e .....

"SELECT Field1, FIeld2 FROM TableName WHERE (Field1='" + Session["Variable"].ToString() + "'";

so that if the session variable was "Debbie"
it would bring back DEBBIE, debbie, DeBbIe etc.

Can anyone help?
thanks so much.
Debs
Oct 9 '07 #1
11 3698
r035198x
13,262 8TB
Hiya,

I am querying an Oracle database that I have no direct access to so cannot change server properties.
I need to do a case insensitive search on a name/or other variable (C# code)
i.e .....

"SELECT Field1, FIeld2 FROM TableName WHERE (Field1='" + Session["Variable"].ToString() + "'";

so that if the session variable was "Debbie"
it would bring back DEBBIE, debbie, DeBbIe etc.

Can anyone help?
thanks so much.
Debs
You can UPPER both sides of the = sign to avoid case diffrences.
Oct 9 '07 #2
You can UPPER both sides of the = sign to avoid case diffrences.
could you give me an example because I 'm sure I tried that
thanks Debs
Oct 9 '07 #3
could you give me an example because I 'm sure I tried that
thanks Debs

The problem could be that I need to use it in conjunction with LIKE ;o(

i.e
SELECT Field1, FIeld2 FROM TableName WHERE (Field1 LIKE '" + Session["Variable"].ToString() + "'";
Is that possible?
Thanks
Debs
Oct 9 '07 #4
r035198x
13,262 8TB
The problem could be that I need to use it in conjunction with LIKE ;o(

i.e
SELECT Field1, FIeld2 FROM TableName WHERE (Field1 LIKE '" + Session["Variable"].ToString() + "'";
Is that possible?
Thanks
Debs
Yes it's possible

Expand|Select|Wrap|Line Numbers
  1. where UPPER(Field) LIKE UPPER(...)
P.S Sometimes the best way to learn things is to try them and observe the results.
Oct 9 '07 #5
Yes it's possible

Expand|Select|Wrap|Line Numbers
  1. where UPPER(Field) LIKE UPPER(...)
P.S Sometimes the best way to learn things is to try them and observe the results.

THanks yes that's what I've tried but its not working. I think the problem is something else. The variable I am passing in may contain invalid characters such as ';' or '/' - now I can of course use 'replace' to strip these out but as they exist in the oracle db field then the LIKE will not work. Is there a way round this?
thanks
Debs
Oct 9 '07 #6
r035198x
13,262 8TB
THanks yes that's what I've tried but its not working. I think the problem is something else. The variable I am passing in may contain invalid characters such as ';' or '/' - now I can of course use 'replace' to strip these out but as they exist in the oracle db field then the LIKE will not work. Is there a way round this?
thanks
Debs
Why do you want to replace those if you want to search for them? When you say it's not working do you mean it gives an error/exception?
Oct 9 '07 #7
Why do you want to replase those if you want to search for them? When you say it's not working do you mean it gives an error/exception?

yes sorry - ORACLE error 'invalid character'
Oct 9 '07 #8
r035198x
13,262 8TB
yes sorry - ORACLE error 'invalid character'
Post the code that you had used for this.

Edit: Why do you have the ( after the where?
Oct 9 '07 #9
Post the code that you had used for this.

Edit: Why do you have the ( after the where?
This is the code and I know the record exists. What am I doing wrong :O(

SQL=SELECT B.R_EXPEDIOREFERENCE ExpedioRef,B.R_CUSTOMERREFERENCE Reference,B.R_TITLE Title,B.R_CONTRACTREQUESTTYPE Type, B.R_REQUESTSTATUS Status, B.R_REQUESTTASK Task ,A.ORIGINATORSURNAME Originator, A.CONTACTSURNAME Requestor FROM aradmin.EXP__I_F__CREATE_REQUEST A, aradmin.exp__request B WHERE (B.R_SOURCE = 'KANA' AND A.EXPEDIOREFERENCE = B.R_EXPEDIOREFERENCE AND B.BFG_CONTRACTID='4318' AND (UPPER(R_TITLE) LIKE UPPER('%Retrospective: Meridian upgrade%')) AND A.ORIGINATORSURNAME='Saynor')
Oct 9 '07 #10
r035198x
13,262 8TB
This is the code and I know the record exists. What am I doing wrong :O(

SQL=SELECT B.R_EXPEDIOREFERENCE ExpedioRef,B.R_CUSTOMERREFERENCE Reference,B.R_TITLE Title,B.R_CONTRACTREQUESTTYPE Type, B.R_REQUESTSTATUS Status, B.R_REQUESTTASK Task ,A.ORIGINATORSURNAME Originator, A.CONTACTSURNAME Requestor FROM aradmin.EXP__I_F__CREATE_REQUEST A, aradmin.exp__request B WHERE (B.R_SOURCE = 'KANA' AND A.EXPEDIOREFERENCE = B.R_EXPEDIOREFERENCE AND B.BFG_CONTRACTID='4318' AND (UPPER(R_TITLE) LIKE UPPER('%Retrospective: Meridian upgrade%')) AND A.ORIGINATORSURNAME='Saynor')
Are you missing some AS words in there?
As in

Expand|Select|Wrap|Line Numbers
  1. SELECT B.R_EXPEDIOREFERENCE AS ExpedioRef,B.R_CUSTOMERREFERENCE AS Reference,B.R_TITLE AS Title,B.R_CONTRACTREQUESTTYPE AS Type ...
Oct 9 '07 #11
amitpatel66
2,367 Expert 2GB
This is the code and I know the record exists. What am I doing wrong :O(

SQL=SELECT B.R_EXPEDIOREFERENCE ExpedioRef,B.R_CUSTOMERREFERENCE Reference,B.R_TITLE Title,B.R_CONTRACTREQUESTTYPE Type, B.R_REQUESTSTATUS Status, B.R_REQUESTTASK Task ,A.ORIGINATORSURNAME Originator, A.CONTACTSURNAME Requestor FROM aradmin.EXP__I_F__CREATE_REQUEST A, aradmin.exp__request B WHERE (B.R_SOURCE = 'KANA' AND A.EXPEDIOREFERENCE = B.R_EXPEDIOREFERENCE AND B.BFG_CONTRACTID='4318' AND (UPPER(R_TITLE) LIKE UPPER('%Retrospective: Meridian upgrade%')) AND A.ORIGINATORSURNAME='Saynor')
Try below query:
Expand|Select|Wrap|Line Numbers
  1. SQL=SELECT B.R_EXPEDIOREFERENCE ExpedioRef,B.R_CUSTOMERREFERENCE Reference,B.R_TITLE Title,B.R_CONTRACTREQUESTTYPE Type, B.R_REQUESTSTATUS Status, B.R_REQUESTTASK Task ,A.ORIGINATORSURNAME Originator, A.CONTACTSURNAME Requestor FROM aradmin.EXP__I_F__CREATE_REQUEST A, aradmin.exp__request B WHERE B.R_SOURCE = 'KANA' AND A.EXPEDIOREFERENCE = B.R_EXPEDIOREFERENCE AND B.BFG_CONTRACTID='4318' AND UPPER(R_TITLE) LIKE UPPER('%Retrospective: Meridian upgrade%') AND A.ORIGINATORSURNAME='Saynor'
  2.  
I have removed the "(" where ever not required
Oct 10 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: noah | last post by:
Can anyone think of a way to make array keys case insensitive? An option on any recent PHP would be to convert all array keys to lowercase using the standard array_change_key_case() function. As...
5
by: Madjid Nasiri | last post by:
Hi, I am basic in oracle. My Old programs write with Delphi and Databases: Access, Paradox, MySQL, Microsoft SQL. I write my code (SQL code) case-insensitivae, but now i need use oracle database....
12
by: Relaxin | last post by:
Is there a way to make Postgresql case-INSENSITIVE? Thanks
2
by: Tom | last post by:
Hi, Our development team is adding DB2 8.1 compatibility to our existing application which currently supports SQLServer 2000. Our code is written to take advantage of SQLServer's ability to ...
2
by: Jan Bols | last post by:
I'm using Oracle 8.1.7 on a linux server. I'm using ms access 2002 as a front end to connect to the dbserver with the oracle ODBC driver on a win2k machine. When I use the filter functionality...
6
by: David Garamond | last post by:
in oracle 10g, you can issue: ALTER SESSION SET NLS_COMP = ansi; ALTER SESSION SET NLS_SORT = binary_ci; do you think this is an elegant solution for case insensitive sorting & searching? is...
1
by: Odd Bjørn Andersen | last post by:
Is there a way to achieve that a select against a database will be case insensitive? Meaning that 'select ' from tab1 where col1 = 'abc'' will return the same result as 'select ' from tab1 where...
0
by: John A Grandy | last post by:
I have always extracted query string params assuming that I could specify the param name case-insensitive : string param = Request.QueryString; Is there any scenario in which this would not...
6
by: Derik | last post by:
Okay, I THINK this is a PHP question... I've been mucking with PHP for awhile now, but just recently I've been poking at some ajax stuff, and I ran into something confusing; my Queries were...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.