Home » SQL & PL/SQL » SQL & PL/SQL » case-sensitive
case-sensitive [message #219225] Tue, 13 February 2007 10:58 Go to next message
durai
Messages: 38
Registered: December 2006
Member
i heared that sql is not case-sensitive, but the following queries doesn't look like that

SQL> select * from sample1;

ENAME ENO
---------------------- -----------
aaa a001
BBB B001
CCC c001

SQL> select * from sample1 where ename ='AAA';

no rows selected

SQL> select * from sample1 where ename ='aaa';

ENAME ENO
---------------------- -----------
aaa a001

what's the difference between
select * from sample1 where ename ='AAA';
and
select * from sample1 where ename ='aaa';

i will be grateful if i get the answer
Re: case-sensitive [message #219228 is a reply to message #219225] Tue, 13 February 2007 11:08 Go to previous messageGo to next message
MarcL
Messages: 455
Registered: November 2006
Location: Connecticut, USA
Senior Member
SQL is neither case sensitive nor non-case sensitve, it is a product of the database you are attaching to.
Re: case-sensitive [message #219238 is a reply to message #219228] Tue, 13 February 2007 11:34 Go to previous messageGo to next message
durai
Messages: 38
Registered: December 2006
Member
i couldn't understand ur answer,

i want to know the difference between

select * from sample1 where ename ='AAA';
and
select * from sample1 where ename ='aaa';


why the above query giving different results
Re: case-sensitive [message #219239 is a reply to message #219225] Tue, 13 February 2007 11:52 Go to previous messageGo to next message
MarcL
Messages: 455
Registered: November 2006
Location: Connecticut, USA
Senior Member
because aaa does not equal AAA


Re: case-sensitive [message #219243 is a reply to message #219239] Tue, 13 February 2007 12:09 Go to previous messageGo to next message
durai
Messages: 38
Registered: December 2006
Member
ya u are right aaa does not equal AAA

according to ur point of view how
select * from sample1
and
select * from SAMPLE1

should be equal
Re: case-sensitive [message #219244 is a reply to message #219225] Tue, 13 February 2007 12:11 Go to previous messageGo to next message
MarcL
Messages: 455
Registered: November 2006
Location: Connecticut, USA
Senior Member
What else can I say, database objects are not case-sensitive,
but data certainly is.

If this is an issue and you are using Oracle, there are ways to force all uppercase or all lowercase at the datbase level, but it's generally not a good idea to do this.

Re: case-sensitive [message #219245 is a reply to message #219225] Tue, 13 February 2007 12:11 Go to previous messageGo to next message
smartin
Messages: 1803
Registered: March 2005
Location: Jacksonville, Florida
Senior Member
In Oracle, the SQL language syntax itself is not case sensitive.

SELECT * FROM DUAL
is the same as
select * from dual

But string literals, such as 'AAA' or 'aaa' are case sensitive, as you demonstrated above.

(although I want to say that such behavior is controllable through init and/or session parameters, especially regarding sort behavior, but would have to look that up to be positive how)

Also note than whn you create a table, Oracle stores it in the data dictionary in all caps by default. But you can (generally wouldn't want to though) store it in mixed case if you use double quotes (create table "MixED").
Re: case-sensitive [message #219246 is a reply to message #219243] Tue, 13 February 2007 12:12 Go to previous messageGo to next message
joy_division
Messages: 4642
Registered: February 2005
Location: East Coast USA
Senior Member
Please do not use IM speak.

There is a differece between a "command" and a "value." Commands can be mixed case. Values are values. 'AAA' does not equal 'aaa,' just as 42 does not equal 3.14159.
Re: case-sensitive [message #219248 is a reply to message #219244] Tue, 13 February 2007 12:14 Go to previous message
smartin
Messages: 1803
Registered: March 2005
Location: Jacksonville, Florida
Senior Member
MarcL wrote on Tue, 13 February 2007 12:11

and you are using Oracle


It is generally assumed, since this is an oracle specific board, that all questions and answers are in the context of being used against an oracle database.
Previous Topic: how to delim records in sqlplus
Next Topic: Bond Yield / Price Calculation
Goto Forum:
  


Current Time: Thu Dec 08 03:59:09 CST 2016

Total time taken to generate the page: 0.10202 seconds