DIGIT-ARC read-only archive · snapshot: July 23, 2026

A simple Question about Query ?

6 posts · originally from https://geek.digit.in/community/threads/a-simple-question-about-query.74924/

P
perk_bud Original post #1
Dec 5, 2007 at 7:36 PM
What is the difference between the two statements

select * from table_name where column_name(number or numeric) = '1';
select * from table_name where column_name(number or numeric) = 1;

Both return the same result so why is that only when using string we have to use apostrophe

Example : -

select * from table_name where column_name(varchar)= 'searchstring' ;

And why is that when we use numeric datafield there is no affect can any 1 explain me this Funda ?
Faun
Faun #2
Dec 5, 2007 at 7:45 PM
perk_bud said:
What is the difference between the two statements

select * from table_name where column_name(number or numeric) = '1';
select * from table_name where column_name(number or numeric) = 1;

Both return the same result so why is that only when using string we have to use apostrophe

Example : -

select * from table_name where column_name(varchar)= 'searchstring' ;

And why when we use it numeric datafield there is no affect can any 1 explain me this Funda ?
try out a string like this

strings are fun

without quotes:D

Btw SQLPlus is smart enuf to do conversion automatically.
P
Dec 5, 2007 at 7:58 PM
T159 said:
try out a string like this

strings are fun

without quotes:D

Btw SQLPlus is smart enuf to do conversion automatically.

I din't get the "strings are fun" part and my question is that if the SQLPLus is smart enough to differenciate between numbers like 1 or '1' why can't it do the same for strings like where column_name= string rather than column name='string'.
Pathik
Pathik #4
Dec 5, 2007 at 8:06 PM
If u include spaces or special characters in ur string then u ll need the apostrophes. also it s a good programming practice.
Faun
Faun #5
Dec 5, 2007 at 8:21 PM
perk_bud said:
I din't get the "strings are fun" part and my question is that if the SQLPLus is smart enough to differenciate between numbers like 1 or '1' why can't it do the same for strings like where column_name= string rather than column name='string'.

k buddy u r not getting the point,

what if i hav astring like this 2.45 islessthanbingo

Now here SQLPlus will go bonkers, thats why u always need delimiters for strings, read some book on regular expresssions.
P
Dec 6, 2007 at 12:21 PM
Thanks a bunch T159 and pathiks i now understood the concept thanks for helping me figure it out :D